Author: Ghostwolf <foxxe@wtfs.net>
[ircu2.10.12-pk.git] / ircd / s_bsd.c
index 5e78031256a5159ab33db4ffd58997a5b793cb0d..e379e61fb2e800b254ba151e0771139b501abdf3 100644 (file)
@@ -773,7 +773,7 @@ static int read_packet(struct Client *cptr, int socket_ready)
 
     /* If there's still data to process, wait 2 seconds first */
     if (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr) &&
-       !(cli_freeflag(cptr) & FREEFLAG_TIMER)) {
+       !t_onqueue(&(cli_proc(cptr)))) {
       Debug((DEBUG_LIST, "Adding client process timer for %C", cptr));
       cli_freeflag(cptr) |= FREEFLAG_TIMER;
       timer_add(&(cli_proc(cptr)), client_timer_callback, cli_connect(cptr),
@@ -1066,9 +1066,9 @@ static void client_timer_callback(struct Event* ev)
 
   assert(0 == cptr || con == cli_connect(cptr));
 
-  con_freeflag(con) &= ~FREEFLAG_TIMER; /* timer has expired... */
-
   if (ev_type(ev)== ET_DESTROY) {
+    con_freeflag(con) &= ~FREEFLAG_TIMER; /* timer has expired... */
+
     if (!con_freeflag(con) && !cptr)
       free_connection(con); /* client is being destroyed */
   } else {