#ident "$Header$"
-/*
+/*
* - general queue handling routines (insert, get)
*/
char *p;
p = strchr(server_name, ':');
-
- if(p)
+
+ if(p)
*p++ = 0;
if((eq = malloc(sizeof(*eq))) == NULL) {
if(p)
*(p-1) = ':';
-
+
#if defined(IL_NOTIFICATIONS) || defined(IL_WS)
eq->dest_port = atoi(p);
#else
#if defined(INTERLOGD_EMS)
struct event_queue_msg *tail;
#endif
-
+
assert(eq != NULL);
- if((el = malloc(sizeof(*el))) == NULL)
+ if((el = malloc(sizeof(*el))) == NULL)
return(set_error(IL_NOMEM, ENOMEM, "event_queue_insert: not enough room for queue element"));
el->msg = server_msg_copy(msg);
eq->tail = el;
}
eq->tail_ems = el;
- } else
+ } else
#endif
- {
+ {
/* normal messages */
if(eq->tail)
eq->tail->prev = el;
#if defined(INTERLOGD_EMS)
/* if we are inserting message between mark_prev and mark_this,
we have to adjust mark_prev accordingly */
- if(eq->mark_this && (el->prev == eq->mark_this))
+ if(eq->mark_this && (el->prev == eq->mark_this))
eq->mark_prev = el;
#endif
assert(eq != NULL);
assert(msg != NULL);
-
+
event_queue_lock(eq);
el = eq->head;
#if defined(INTERLOGD_EMS)
}
-int
+int
event_queue_remove(struct event_queue *eq)
{
struct event_queue_msg *el;
eq->tail = NULL;
}
#endif
- if(--eq->cur_len == 0)
+ if(--eq->cur_len == 0)
eq->times_empty++;
event_queue_unlock(eq);
/* end of critical section */
-
+
server_msg_free(el->msg);
free(el);
}
int
-event_queue_move_events(struct event_queue *eq_s,
- struct event_queue *eq_d,
- int (*cmp_func)(struct server_msg *, void *),
+event_queue_move_events(struct event_queue *eq_s,
+ struct event_queue *eq_d,
+ int (*cmp_func)(struct server_msg *, void *),
void *data)
{
struct event_queue_msg *p, **source_prev, **dest_tail;
while(p) {
if((*cmp_func)(p->msg, data)) {
il_log(LOG_DEBUG, " moving event at offset %d(%d) from %s:%d to %s:%d\n",
- p->msg->offset, p->msg->generation, eq_s->dest_name, eq_s->dest_port,
+ p->msg->offset, p->msg->generation, eq_s->dest_name, eq_s->dest_port,
eq_d ? eq_d->dest_name : "trash", eq_d ? eq_d->dest_port : -1);
- il_log(LOG_DEBUG, " current: %x, next: %x\n", p, p->prev);
+ /* il_log(LOG_DEBUG, " current: %x, next: %x\n", p, p->prev); */
/* remove the message from the source list */
*source_prev = p->prev;
if(eq_d) {