diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-08 14:53:28 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-08 14:53:28 +0200 |
commit | 936b2f5c3f2df88c21c0961f35ed215adf02e17f (patch) | |
tree | 10ff0b8ba8c3fea5a7b0f1c045455248cd194437 /src | |
parent | pack client_list on danger (diff) | |
download | mds-936b2f5c3f2df88c21c0961f35ed215adf02e17f.tar.gz mds-936b2f5c3f2df88c21c0961f35ed215adf02e17f.tar.bz2 mds-936b2f5c3f2df88c21c0961f35ed215adf02e17f.tar.xz |
mds-registry: take care of danger
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mds-registry/globals.h | 4 | ||||
-rw-r--r-- | src/mds-registry/mds-registry.c | 13 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/mds-registry/globals.h b/src/mds-registry/globals.h index bd83ff4..110077d 100644 --- a/src/mds-registry/globals.h +++ b/src/mds-registry/globals.h @@ -55,7 +55,7 @@ extern hash_table_t reg_table; /** * Reusable buffer for data to send */ -extern char* send_buffer; /* TODO free on danger */ +extern char* send_buffer; /** * The size of `send_buffer` @@ -75,7 +75,7 @@ extern size_t running_slaves; /** * List of running slaves */ -extern linked_list_t slave_list; /* TODO pack on danger */ +extern linked_list_t slave_list; /** * Mutex for slave data diff --git a/src/mds-registry/mds-registry.c b/src/mds-registry/mds-registry.c index f753f26..741423c 100644 --- a/src/mds-registry/mds-registry.c +++ b/src/mds-registry/mds-registry.c @@ -152,12 +152,19 @@ int postinitialise_server(void) */ int master_loop(void) { - int rc = 1; + int rc = 1, r; while (!reexecing && !terminating) { - int r = mds_message_read(&received, socket_fd); - if (r == 0) + if (danger) + { + danger = 0; + free(send_buffer), send_buffer = NULL; + send_buffer_size = 0; + with_mutex (slave_mutex, linked_list_pack(&slave_list);); + } + + if (r = mds_message_read(&received, socket_fd), r == 0) if (r = handle_message(), r == 0) continue; |