]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Clear score table on mood reload.
authorAndre Noll <maan@systemlinux.org>
Sun, 5 Jun 2011 17:14:37 +0000 (19:14 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 13 Jun 2011 12:23:35 +0000 (14:23 +0200)
Whenever a blob is added, the mood event handler is called
which may reload the current mood in order to react to the
change being made. However, we missed to clear the score table
first. This is necessary to to re-insert all admissible files.
Currently this fails with

afs_event: table moods, event 8: key already exists in rbtree

mood.c

diff --git a/mood.c b/mood.c
index d82d5a52c3b704cffd3657c9b6bad25121c5b4f2..93461ee845c558ec30c0da78bf548939f1247857 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -904,6 +904,8 @@ static int reload_current_mood(void)
 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) {
@@ -916,6 +918,10 @@ int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb
        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: