Commit cb65ff6ecfa7aaaa00e83099fc9a0b3415ba32c1
move response port getter to hypervisor
wanderer committed on 10/24/2017, 12:14:52 AMParent: fe17252ec249e039c0e509ba0d745ca0da354881
Files changed
index.js | changed |
kernel.js | changed |
index.js | ||
---|---|---|
@@ -102,8 +102,18 @@ | ||
102 | 102 | return instance |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
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 | + | |
106 | 116 | createChannel () { |
107 | 117 | const port1 = { |
108 | 118 | messages: [] |
109 | 119 | } |
kernel.js | ||
---|---|---|
@@ -112,16 +112,11 @@ | ||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | 115 | 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 | |
124 | 119 | } |
125 | 120 | |
126 | 121 | /** |
127 | 122 | * updates the number of ticks that the container has run |
Built with git-ssb-web