diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-08-12 14:58:58 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-08-12 14:58:58 +0200 |
commit | 5f56397b3c3864afad1fd6a86eb773c6b131ddc3 (patch) | |
tree | e0d4b385f0f88b0a1adf292dc059f82cb73d4b04 | |
parent | add hacking (diff) | |
download | mds-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 '')
-rw-r--r-- | doc/messages | 6 | ||||
-rw-r--r-- | src/mds-server/sending.c | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/doc/messages b/doc/messages index 11409c4..b9bd825 100644 --- a/doc/messages +++ b/doc/messages @@ -95,7 +95,11 @@ is not modified. If the message should be modify it the value of the ‘Modify’ header should be ‘yes’ and the payload should be the new message with all the, possibly modified, headers the new -payload. +payload. A server may also choose to consume a +message message, this is done by responding +without a payload and include ‘Modify: yes’. +Once a message is consumed it will not be sent +to any additional servers. Unless a client's ID is 0:0 (allowed even if it is 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; } } |