git ssb

0+

wanderer🌟 / js-primea-hypervisor



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.jschanged
inbox.jschanged
package-lock.jsonchanged
package.jsonchanged
actor.jsView
@@ -143,8 +143,9 @@
143143 * @param {Message} message - the message
144144 */
145145 send (cap, message) {
146146 message._fromTicks = this.ticks
147+ message._fromId = this.id
147148 message.tag = cap.tag
148149
149150 return this.hypervisor.send(cap, message)
150151 }
inbox.jsView
@@ -1,5 +1,6 @@
11 const binarySearchInsert = require('binary-search-insert')
2+// const Buffer = require('safe-buffer').Buffer
23
34 module.exports = class Inbox {
45 /**
56 * The port manager manages the the ports. This inculdes creation, deletion
@@ -116,8 +117,8 @@
116117 // order by number of ticks if messages have different number of ticks
117118 if (messageA._fromTicks !== messageB._fromTicks) {
118119 return messageA._fromTicks < messageB._fromTicks ? messageA : messageB
119120 } else {
120- // insertion order
121- return messageA
121+ // sender id
122+ return Buffer.compare(messageA._fromId, messageB._fromId) ? messageA : messageB
122123 }
123124 }
package-lock.jsonView
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
package.jsonView
@@ -32,8 +32,9 @@
3232 "dependencies": {
3333 "binary-search-insert": "^1.0.3",
3434 "lockmap": "0.0.0",
3535 "primea-message": "0.0.3",
36+ "safe-buffer": "^5.1.1",
3637 "sortedmap": "0.0.1",
3738 "typedarray-addition": "0.0.1"
3839 },
3940 "devDependencies": {

Built with git-ssb-web