diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-08 14:45:21 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-08 14:45:21 +0200 |
commit | 4d4f5ad6b4374c268737e83ec603c1b93d09f8e6 (patch) | |
tree | b47e6adf87fd7343d6c2ba764ddf005d9780f1e1 | |
parent | do not resend danger to other threads (diff) | |
download | mds-4d4f5ad6b4374c268737e83ec603c1b93d09f8e6.tar.gz mds-4d4f5ad6b4374c268737e83ec603c1b93d09f8e6.tar.bz2 mds-4d4f5ad6b4374c268737e83ec603c1b93d09f8e6.tar.xz |
pack client_list on danger
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-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, |