From 4d4f5ad6b4374c268737e83ec603c1b93d09f8e6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 8 Sep 2014 14:45:21 +0200 Subject: pack client_list on danger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-server/globals.h | 2 +- src/mds-server/mds-server.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/mds-server') 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, -- cgit v1.2.3-70-g09d2