X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=blobdiff_plain;f=src%2FWHOHandler.c;h=f8769decabbce38aa79444156a7b1006b3450e83;hp=076afd3c0ed1655a9fb2870ad95c7e5c9a776e5d;hb=c32e8254ec4ed0d77757e32f8aa5aabcdb494057;hpb=77b1c3e45f25e5a000b06a551e3b2329ad2db8a0 diff --git a/src/WHOHandler.c b/src/WHOHandler.c index 076afd3..f8769de 100644 --- a/src/WHOHandler.c +++ b/src/WHOHandler.c @@ -41,14 +41,6 @@ struct WHOQueueEntry { void *data[MAXCALLBACKS]; }; -#ifdef HAVE_THREADS -struct ParseOrder { - unsigned long tid; - struct ParseOrder *next; -}; -struct ParseOrder *parse_order = NULL; -#endif - static int checkWHOID(struct ClientSocket *client, int whoid) { struct WHOQueueEntry *entry; for(entry = client->whoqueue_first; entry; entry = entry->next) { @@ -122,42 +114,6 @@ void clear_whoqueue(struct ClientSocket *client) { DESYNCHRONIZE(whohandler_sync); } -#if HAVE_THREADS -void whohandler_start_of_recv(struct ClientSocket *client, unsigned long tid) { - SYNCHRONIZE(whohandler_sync); - struct ParseOrder *entry, *last; - for(last = parse_order; last; last = last->next) { - if(last->next == NULL) - break; - } - entry = malloc(sizeof(*entry)); - entry->tid = tid; - entry->next = NULL; - if(last) - last->next = entry; - else - parse_order = entry; - DESYNCHRONIZE(whohandler_sync); -} - -void whohandler_end_of_recv(struct ClientSocket *client, unsigned long tid) { - SYNCHRONIZE(whohandler_sync); - struct ParseOrder *entry, *last = NULL; - for(entry = parse_order; entry; entry = entry->next) { - if(entry->tid == tid) { - if(last) - last->next = entry->next; - else - parse_order = entry->next; - free(entry); - break; - } else - last = entry; - } - DESYNCHRONIZE(whohandler_sync); -} -#endif - void get_userlist(struct ChanNode *chan, userlist_callback_t callback, void *data) { struct ClientSocket *bot; for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { @@ -287,8 +243,8 @@ static void _recv_whohandler_354(struct ClientSocket *client, char **argv, unsig if(entry == NULL) return; #ifdef HAVE_THREADS unsigned long tid = syscall(SYS_gettid); - while(parse_order->tid != tid) { - usleep(5000); //5ms + while(!clientsocket_parseorder_top(tid)) { + usleep(1000); //1ms } #endif if(entry->type & WHOQUEUETYPE_USERLIST) { @@ -383,8 +339,8 @@ static void _recv_whohandler_315(struct ClientSocket *client, char **argv, unsig if(entry == NULL) return; #ifdef HAVE_THREADS unsigned long tid = syscall(SYS_gettid); - while(parse_order->tid != tid) { - usleep(5000); //5ms + while(!clientsocket_parseorder_top(tid)) { + usleep(1000); //1ms } #endif getNextWHOQueueEntry(client, type, 1);