git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit cb65ff6ecfa7aaaa00e83099fc9a0b3415ba32c1

move response port getter to hypervisor

wanderer committed on 10/24/2017, 12:14:52 AM
Parent: fe17252ec249e039c0e509ba0d745ca0da354881

Files changed

index.jschanged
kernel.jschanged
index.jsView
@@ -102,8 +102,18 @@
102102 return instance
103103 }
104104 }
105105
106+ getResponsePort (message) {
107+ if (message.responsePort) {
108+ return message.responsePort.destPort
109+ } else {
110+ const [portRef1, portRef2] = this.createChannel()
111+ message.responsePort = portRef2
112+ return portRef1
113+ }
114+ }
115+
106116 createChannel () {
107117 const port1 = {
108118 messages: []
109119 }
kernel.jsView
@@ -112,16 +112,11 @@
112112 }
113113 }
114114
115115 getResponsePort (message) {
116- if (message.responsePort) {
117- return message.responsePort.destPort
118- } else {
119- const [portRef1, portRef2] = this.ports.createChannel()
120- message.responsePort = portRef2
121- this.ports._unboundPorts.delete(portRef2)
122- return portRef1
123- }
116+ const portRef = this.hypervisor.getResponsePort(message)
117+ this.ports._unboundPorts.add(portRef)
118+ return portRef
124119 }
125120
126121 /**
127122 * updates the number of ticks that the container has run

Built with git-ssb-web