* copy the FD so we're safe of other threads setting it to -1 meanwhile
authorWilfried Göesgens <willi@citadel.org>
Sun, 14 Feb 2010 11:34:41 +0000 (11:34 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sun, 14 Feb 2010 11:34:41 +0000 (11:34 +0000)
citadel/sysdep.c

index bf8a7adf1354fa6fcd1fef63023432d93e4b3415..33c42696d65e50f7568a94955e8dbff9d67da1ac 100644 (file)
@@ -971,14 +971,16 @@ do_select:        force_purge = 0;
 
                begin_critical_section(S_SESSION_TABLE);
                for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
+                       int client_socket;
+                       client_socket = ptr->client_socket;
                        /* Dont select on dead sessions only truly idle ones */
                        if ((ptr->state == CON_IDLE) && 
                            (CC->kill_me == 0) &&
-                           (ptr->client_socket != -1))
+                           (client_socket != -1))
                        {
-                               FD_SET(ptr->client_socket, &readfds);
-                               if (ptr->client_socket > highest)
-                                       highest = ptr->client_socket;
+                               FD_SET(client_socket, &readfds);
+                               if (client_socket > highest)
+                                       highest = client_socket;
                        }
                        if ((bind_me == NULL) && (ptr->state == CON_READY)) {
                                bind_me = ptr;