aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-server
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-08-12 14:58:58 +0200
committerMattias Andrée <maandree@operamail.com>2014-08-12 14:58:58 +0200
commit5f56397b3c3864afad1fd6a86eb773c6b131ddc3 (patch)
treee0d4b385f0f88b0a1adf292dc059f82cb73d4b04 /src/mds-server
parentadd hacking (diff)
downloadmds-5f56397b3c3864afad1fd6a86eb773c6b131ddc3.tar.gz
mds-5f56397b3c3864afad1fd6a86eb773c6b131ddc3.tar.bz2
mds-5f56397b3c3864afad1fd6a86eb773c6b131ddc3.tar.xz
make it possible to consume messages
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-server')
-rw-r--r--src/mds-server/sending.c8
1 files changed, 7 insertions, 1 deletions
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;
}
}