* Noticed that when serv_chat.c sets async_waiting to 1, it also checks to see if...
authorArt Cancro <ajc@citadel.org>
Thu, 25 Feb 2010 05:21:39 +0000 (05:21 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 25 Feb 2010 05:21:39 +0000 (05:21 +0000)
citadel/context.c
citadel/context.h
citadel/modules/chat/serv_chat.c
citadel/modules/xmpp/xmpp_queue.c

index 38394b7f44e05484960faa26f4fd21e984154f1a..6c6a20453c214e7d5dad07d10923a5f35c75c24e 100644 (file)
@@ -586,4 +586,16 @@ INLINE void become_session(CitContext *which_con) {
 }
 
 
-
+/*
+ * Set the "async waiting" flag for a session, if applicable
+ */
+void set_async_waiting(struct CitContext *ccptr)
+{
+       CtdlLogPrintf(CTDL_DEBUG, "Setting async_waiting flag for session %d\n", ccptr->cs_pid);
+       if (ccptr->is_async) {
+               ccptr->async_waiting = 1;
+               if (ccptr->state == CON_IDLE) {
+                       ccptr->state = CON_READY;
+               }
+       }
+}
index 1e57f2f39fc9ec7798ae660fbde2348c7f35b0b2..ddf8d6ca136f57d8c550eb969ce46a6d2f9e8d9f 100644 (file)
@@ -159,6 +159,7 @@ void kill_session (int session_to_kill);
 INLINE void become_session(struct CitContext *which_con);
 void InitializeMasterCC(void);
 void dead_session_purge(int force);
+void set_async_waiting(struct CitContext *ccptr);
 
 /* Deprecated, user CtdlBumpNewMailCounter() instead */
 void BumpNewMailCounter(long) __attribute__ ((deprecated));
index f0f1e7d6c40f4a73d976372cf27f75cf9c28628d..028f2833b821716f529323d3c2f53e5d51225ddc 100644 (file)
@@ -650,12 +650,7 @@ void add_xmsg_to_context(struct CitContext *ccptr, struct ExpressMessage *newmsg
        /* If the target context is a session which can handle asynchronous
         * messages, go ahead and set the flag for that.
         */
-       if (ccptr->is_async) {
-               ccptr->async_waiting = 1;
-               if (ccptr->state == CON_IDLE) {
-                       ccptr->state = CON_READY;
-               }
-       }
+       set_async_waiting(ccptr);
 }
 
 
index 3bd8c95d7bdf2d871c22b988a1242e88f833a20e..24e474aa4cbac21842056149fe25b3c361d212d9 100644 (file)
@@ -113,7 +113,7 @@ void xmpp_queue_event(int event_type, char *email_addr) {
        begin_critical_section(S_SESSION_TABLE);
        for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
                if ((cptr->logged_in) && (cptr->h_async_function == xmpp_async_loop)) {
-                       cptr->async_waiting = 1;
+                       set_async_waiting(cptr);
                }
        }
        end_critical_section(S_SESSION_TABLE);