From: pk910 Date: Wed, 17 Aug 2011 02:59:23 +0000 (+0200) Subject: fixed WHOHandler.c WHO queue X-Git-Tag: v5.3~537 X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;ds=sidebyside;h=36afeec6f6bf93fef4ebab7d48a613eb9bf52c7e;p=NeonServV5.git fixed WHOHandler.c WHO queue --- diff --git a/WHOHandler.c b/WHOHandler.c index df0d399..3e07192 100644 --- a/WHOHandler.c +++ b/WHOHandler.c @@ -32,6 +32,8 @@ static struct WHOQueueEntry* addWHOQueueEntry(struct ClientSocket *client) { entry->client = client; if(last_entry) last_entry->next = entry; + else + last_entry = entry; if(!first_entry) first_entry = entry; return entry; @@ -46,9 +48,14 @@ static struct WHOQueueEntry* getNextWHOQueueEntry(struct ClientSocket *client, i } if(entry == NULL) return NULL; if(freeEntry) { - first_entry = first_entry->next; - if(last_entry == first_entry) - last_entry = NULL; + if(entry == first_entry) + first_entry = entry->next; + if(entry == last_entry) { + struct WHOQueueEntry *last; + for(last = first_entry; last; last = last->next) + if(last->next == NULL) break; + last_entry = last; + } } return entry; }