From 5f56397b3c3864afad1fd6a86eb773c6b131ddc3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 12 Aug 2014 14:58:58 +0200 Subject: make it possible to consume messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-server/sending.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/mds-server') diff --git a/src/mds-server/sending.c b/src/mds-server/sending.c index 98bb26f..3b78e54 100644 --- a/src/mds-server/sending.c +++ b/src/mds-server/sending.c @@ -127,8 +127,10 @@ static void wait_for_reply(client_t* recipient, uint64_t modify_id) */ void multicast_message(multicast_t* multicast) { + int consumed = 0; uint64_t modify_id = 0; size_t n = strlen("Modify ID: "); + if (startswith_n(multicast->message, "Modify ID: ", multicast->message_length, n)) { char* value = multicast->message + n; @@ -180,9 +182,10 @@ void multicast_message(multicast_t* multicast) if (strequals(mod->headers[i], "Modify: yes")) { modifying = 1; + consumed = mod->payload_size == 0; break; } - if (modifying) + if (modifying && !consumed) { n = mod->payload_size; old_buf = multicast->message; @@ -200,6 +203,9 @@ void multicast_message(multicast_t* multicast) /* Reset how much of the message has been sent before we continue with next recipient. */ multicast->message_ptr = 0; + + if (consumed) + break; } } -- cgit v1.2.3-70-g09d2