* set event length on all occasions to enable notif-interlogd clean up correctly
authorMichal Voců <michal@ruk.cuni.cz>
Thu, 9 Sep 2004 12:47:10 +0000 (12:47 +0000)
committerMichal Voců <michal@ruk.cuni.cz>
Thu, 9 Sep 2004 12:47:10 +0000 (12:47 +0000)
* handle queue tails when moving events from one queue to another

org.glite.lb.logger/src/event_queue.c
org.glite.lb.logger/src/server_msg.c

index 2b12d65..1873bde 100644 (file)
@@ -240,6 +240,9 @@ event_queue_remove(struct event_queue *eq)
     /* we are removing last priority message */
     eq->tail_ems = NULL;
   }
+
+  eq->mark_this = NULL;
+  eq->mark_prev = NULL;
 #else
   el = eq->head;
   if(el == NULL) {
@@ -277,6 +280,7 @@ event_queue_move_events(struct event_queue *eq_s, struct event_queue *eq_d, char
        }
        source_prev = &(eq_s->head);
        p = *source_prev;
+       eq_s = NULL;
        while(p) {
                if(strcmp(p->msg->job_id_s, notif_id) == 0) {
                        il_log(LOG_DEBUG, "  moving event with notif id %s from %s to %s\n",
@@ -288,6 +292,7 @@ event_queue_move_events(struct event_queue *eq_s, struct event_queue *eq_d, char
                                p->prev = NULL;
                                *dest_tail = p;
                                dest_tail = &(p->prev);
+                               eq_d->tail = p;
                        } else {
                                /* free the message */
                                server_msg_free(p->msg);
@@ -296,6 +301,7 @@ event_queue_move_events(struct event_queue *eq_s, struct event_queue *eq_d, char
                } else {
                        /* message stays */
                        source_prev = &(p->prev);
+                       eq_s->tail = p;
                }
                p = *source_prev;
        }
index f230a35..69f8fb7 100644 (file)
@@ -164,8 +164,6 @@ server_msg_init(struct server_msg *msg, char *event)
        msg->job_id_s = edg_wll_NotifIdUnparse(notif_event->notification.notifId);
        if(notif_event->notification.jobstat && 
           (strlen(notif_event->notification.jobstat) > 0)) {
-               /* remember to add event separator to the length */
-               msg->ev_len = strlen(event) + 1;
                msg->len = create_msg(event, &msg->msg, &msg->receipt_to);
        }
        edg_wll_FreeEvent(notif_event);
@@ -174,14 +172,15 @@ server_msg_init(struct server_msg *msg, char *event)
                return(-1);
        }
 #else
-       /* remember to add event separator to the length */
-       msg->ev_len = strlen(event) + 1;
        msg->len = create_msg(event, &msg->msg, &msg->receipt_to);
        if(msg->len < 0) {
                return(-1);
        }
        msg->job_id_s = edg_wll_GetJobId(event);
 #endif
+       /* remember to add event separator to the length */
+       msg->ev_len = strlen(event) + 1;
+
        if(msg->job_id_s == NULL) {
                set_error(IL_LBAPI, EDG_WLL_ERROR_PARSE_BROKEN_ULM, "server_msg_init: error getting id");
                return(-1);