*/
int mood_check_callback(struct afs_callback_arg *aca)
{
- int ret;
- struct para_buffer pb = {
- .max_size = shm_get_shmmax(),
- .private_data = &(struct afs_max_size_handler_data) {
- .fd = aca->fd,
- .band = SBD_OUTPUT
- },
- .max_size_handler = afs_max_size_handler
- };
-
- para_printf(&pb, "checking moods...\n");
- ret = osl(osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
+ para_printf(&aca->pbout, "checking moods...\n");
+ return osl(osl_rbtree_loop(moods_table, BLOBCOL_ID, &aca->pbout,
check_mood));
- flush_and_free_pb(&pb);
- return ret;
}
static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
int ret;
char *mood_name = NULL;
+ ret = clear_score_table();
+ if (ret < 0)
+ return ret;
if (!current_mood)
return 1;
PARA_NOTICE_LOG("reloading %s\n", current_mood->name?
int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb,
void *data)
{
- int ret;
-
if (!current_mood)
return 0;
switch (event) {
case BLOB_ADD:
if (data == moods_table || data == playlists_table)
return 1; /* no reload necessary for these */
- ret = clear_score_table();
- if (ret < 0)
- PARA_CRIT_LOG("clear score table returned %s\n",
- para_strerror(-ret));
return reload_current_mood();
/* these also require reload of the score table */
case ATTRIBUTE_ADD: