moonbridge

changeset 294:c78bb327ef6a

Code-cleanup: removed redundancy in moonbr_initiate_shutdown()
author jbe
date Mon Jun 12 15:38:27 2017 +0200 (2017-06-12)
parents b355e259c81e
children 1eef86d3b925
files moonbridge.c
line diff
     1.1 --- a/moonbridge.c	Mon Jun 12 15:28:33 2017 +0200
     1.2 +++ b/moonbridge.c	Mon Jun 12 15:38:27 2017 +0200
     1.3 @@ -1133,6 +1133,8 @@
     1.4  /* Sets global variable 'moonbr_shutdown_in_progress', closes listeners, and demands worker termination */
     1.5  static void moonbr_initiate_shutdown() {
     1.6    struct moonbr_pool *pool;
     1.7 +  int i;
     1.8 +  struct moonbr_worker *worker;
     1.9    if (moonbr_shutdown_in_progress) {
    1.10      moonbr_log(LOG_NOTICE, "Shutdown already in progress");
    1.11      return;
    1.12 @@ -1140,7 +1142,6 @@
    1.13    moonbr_shutdown_in_progress = 1;
    1.14    moonbr_log(LOG_NOTICE, "Initiate shutdown");
    1.15    for (pool = moonbr_first_pool; pool; pool = pool->next_pool) {
    1.16 -    int i;
    1.17      for (i=0; i<pool->listener_count; i++) {
    1.18        struct moonbr_listener *listener = &pool->listener[i];
    1.19        if (listener->listenfd != -1) {
    1.20 @@ -1150,10 +1151,6 @@
    1.21          }
    1.22        }
    1.23      }
    1.24 -  }
    1.25 -  moonbr_poll_shutdown();  /* avoids loops due to error condition when polling closed listeners */
    1.26 -  for (pool=moonbr_first_pool; pool; pool=pool->next_pool) {
    1.27 -    struct moonbr_worker *worker;
    1.28      for (worker=pool->first_worker; worker; worker=worker->next_worker) {
    1.29        if (moonbr_debug) {
    1.30          moonbr_log(LOG_DEBUG, "Sending SIGTERM to child with PID %i", (int)worker->pid);
    1.31 @@ -1163,6 +1160,7 @@
    1.32        }
    1.33      }
    1.34    }
    1.35 +  moonbr_poll_shutdown();  /* avoids loops due to error condition when polling closed listeners */
    1.36  }
    1.37  
    1.38  

Impressum / About Us