Parcourir la source

resume_suspended_connections(): minor optimization

Evgeny Grin (Karlson2k) il y a 8 ans
Parent
commit
02f1f5e5cc
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      src/microhttpd/daemon.c

+ 3 - 2
src/microhttpd/daemon.c

@@ -2833,6 +2833,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
   struct MHD_Connection *pos;
   struct MHD_Connection *prev = NULL;
   int ret;
+  const bool used_thr_p_c = (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION));
 
   ret = MHD_NO;
   MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
@@ -2870,7 +2871,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
           DLL_insert (daemon->connections_head,
                       daemon->connections_tail,
                       pos);
-          if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
+          if (!used_thr_p_c)
             {
               /* Reset timeout timer on resume. */
               if (0 != pos->connection_timeout)
@@ -2916,7 +2917,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
       pos->resuming = false;
     }
   MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
-  if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
+  if ( (used_thr_p_c) &&
        (MHD_NO != ret) )
     { /* Wake up suspended connections. */
       if (! MHD_itc_activate_(daemon->itc,