Commit a3ab8ad379b7b0a8f04de14210c76517f1cf4306
sort messages by the id of the senders
Signed-off-by: wanderer <mjbecze@gmail.com>wanderer committed on 11/17/2017, 12:29:50 AM
Parent: 8b207369b8ac9f26d7a2385a7ae310b72152dce1
Files changed
actor.js | changed |
inbox.js | changed |
package-lock.json | changed |
package.json | changed |
actor.js | ||
---|---|---|
@@ -143,8 +143,9 @@ | ||
143 | 143 | * @param {Message} message - the message |
144 | 144 | */ |
145 | 145 | send (cap, message) { |
146 | 146 | message._fromTicks = this.ticks |
147 | + message._fromId = this.id | |
147 | 148 | message.tag = cap.tag |
148 | 149 | |
149 | 150 | return this.hypervisor.send(cap, message) |
150 | 151 | } |
inbox.js | ||
---|---|---|
@@ -1,5 +1,6 @@ | ||
1 | 1 | const binarySearchInsert = require('binary-search-insert') |
2 | +// const Buffer = require('safe-buffer').Buffer | |
2 | 3 | |
3 | 4 | module.exports = class Inbox { |
4 | 5 | /** |
5 | 6 | * The port manager manages the the ports. This inculdes creation, deletion |
@@ -116,8 +117,8 @@ | ||
116 | 117 | // order by number of ticks if messages have different number of ticks |
117 | 118 | if (messageA._fromTicks !== messageB._fromTicks) { |
118 | 119 | return messageA._fromTicks < messageB._fromTicks ? messageA : messageB |
119 | 120 | } else { |
120 | - // insertion order | |
121 | - return messageA | |
121 | + // sender id | |
122 | + return Buffer.compare(messageA._fromId, messageB._fromId) ? messageA : messageB | |
122 | 123 | } |
123 | 124 | } |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 397798 bytes New file size: 397779 bytes |
Built with git-ssb-web