diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mds-server/globals.h | 2 | ||||
-rw-r--r-- | src/mds-server/mds-server.c | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/mds-server/globals.h b/src/mds-server/globals.h index 0ddf0ba..e9465f0 100644 --- a/src/mds-server/globals.h +++ b/src/mds-server/globals.h @@ -64,7 +64,7 @@ extern fd_table_t client_map; /** * List of client information (client_t) */ -extern linked_list_t client_list; /* TODO pack on danger */ +extern linked_list_t client_list; /** * The next free ID for a client diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c index a77fadb..a2a506e 100644 --- a/src/mds-server/mds-server.c +++ b/src/mds-server/mds-server.c @@ -190,10 +190,18 @@ int __attribute__((const)) postinitialise_server(void) */ int master_loop(void) { - /* Accepting incoming connections. */ + /* Accepting incoming connections and take care of dangers. */ while (running && (terminating == 0)) - if (accept_connection() == 1) - break; + { + if (danger) + { + danger = 0; + with_mutex (slave_mutex, linked_list_pack(&client_list);); + } + + if (accept_connection() == 1) + break; + } /* Join with all slaves threads. */ with_mutex (slave_mutex, |