From 845b8446273efe9171d69e19d297f2e69216a51b Mon Sep 17 00:00:00 2001 From: Dave West Date: Wed, 24 Feb 2010 16:32:08 +0000 Subject: [PATCH] Fix async messages (hopefully). --- citadel/sysdep.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 459b44ab2..a0b27a46e 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -1104,17 +1104,24 @@ do_select: force_purge = 0; begin_critical_section(S_SESSION_TABLE); for (ptr = ContextList; ptr != NULL; ptr = ptr->next) { int checkfd = ptr->client_socket; - if ((checkfd != -1) && - (FD_ISSET(checkfd, &readfds)) && - (ptr->state == CON_IDLE) ) - { - ptr->input_waiting = 1; - if (!bind_me) { - bind_me = ptr; /* I choose you! */ - bind_me->state = CON_EXECUTING; - } - else { - ptr->state = CON_READY; + if ((checkfd != -1) && (ptr->state == CON_IDLE) ){ + if (FD_ISSET(checkfd, &readfds)) { + ptr->input_waiting = 1; + if (!bind_me) { + bind_me = ptr; /* I choose you! */ + bind_me->state = CON_EXECUTING; + } + else { + ptr->state = CON_READY; + } + } else if ((ptr->is_async) && (ptr->async_waiting) && (ptr->h_async_function)) { + if (!bind_me) { + bind_me = ptr; /* I choose you! */ + bind_me->state = CON_EXECUTING; + } + else { + ptr->state = CON_READY; + } } } } -- 2.39.2