| … | … | @@ -10,7 +10,7 @@ |
| 10 | 10 | * |
| 11 | 11 | * LICENSE: |
| 12 | 12 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 13 | | * |
| 13 | * |
| 14 | 14 | * This program is free software; you can redistribute it and/or modify |
| 15 | 15 | * it under the terms of the GNU Affero General Public License v3 as |
| 16 | 16 | * published by the Free Software Foundation and including the exceptions |
| … | … | @@ -84,24 +84,16 @@ class CogChannel |
| 84 | 84 | // The mesage buffer is a de-duplicating buffer: identical |
| 85 | 85 | // messages are added only once. This makes sense for almost |
| 86 | 86 | // all messages: we do not need to store an Atom twice; the |
| 87 | | // store operation is idempotent. There are two exceptions. |
| 88 | | // One is the cog-value-increment message: these are never |
| 89 | | // idempotent; we use a sequence number to make sure each is |
| 90 | | // unique. The other case is the barrier. The exact same |
| 91 | | // barrier message must be sent to each socket. The barrier |
| 92 | | // code will make sure that the queues are all empty before |
| 93 | | // enqueuing the barrier, so ordering does not matter, but |
| 94 | | // having exactly NTHREADS copies does. It must not be |
| 95 | | // deduplicated So that is what this ctor does. |
| 87 | // store operation is idempotent. The one exception is the |
| 88 | // cog-update-value! message: these are never idempotent; |
| 89 | // we use a sequence number to make sure each is unique. |
| 96 | 90 | Msg(Client* c, void (Client::*cb)(const std::string&, const Data&), |
| 97 | 91 | bool nr, const std::string& str, const Data& d) |
| 98 | 92 | : client(c), callback(cb), noreply(nr), |
| 99 | 93 | str_to_send(str), data(d) |
| 100 | 94 | { |
| 101 | 95 | // Non-idempotent messages get unique sequence numbers. |
| 102 | | // "(cog-barrier " - note trailing space, not closing paren! |
| 103 | | if (str.compare(0, 19, "(cog-update-value!") == 0 or |
| 104 | | str.compare(0, 13, "(cog-barrier ") == 0) |
| 96 | if (str.compare(0, 19, "(cog-update-value!") == 0) |
| 105 | 97 | { |
| 106 | 98 | sequence = ++_sequence_counter; |
| 107 | 99 | } |