git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 3030de38492c87f7b57f1f8aff89e519f8208090

remove checking for ports binding on sending

wanderer committed on 6/6/2017, 4:58:22 AM
Parent: 71d82f6ed10cf2f8cd6809c0eecac2665da38749

Files changed

exoInterface.jschanged
tests/index.jschanged
exoInterface.jsView
@@ -155,12 +155,8 @@
155155 * @param {Object} portRef - the port
156156 * @param {Message} message - the message
157157 */
158158 async send (portRef, message) {
159- if (!this.ports.isBound(portRef)) {
160- throw new Error('cannot send message with an unbound port')
161- }
162-
163159 // set the port that the message came from
164160 message._fromPort = this.entryPort
165161 message._fromPortTicks = this.ticks
166162
tests/index.jsView
@@ -196,8 +196,10 @@
196196
197197 t.equals(runs, 3, 'the number of run should be 3')
198198 const nonce = await hypervisor.graph.get(root.state, 'ports/first/link/nonce/0')
199199 t.equals(nonce, 3, 'should have the correct nonce')
200 +
201 + await hypervisor.graph.tree(root.state, Infinity)
200202 })
201203
202204 tape('traps', async t => {
203205 t.plan(1)
@@ -228,37 +230,8 @@
228230 }
229231 }, 'should revert the state')
230232 })
231233
232- tape('invalid port referances', async t => {
233- t.plan(2)
234- class Root extends BaseContainer {
235- async run (m) {
236- const port = this.kernel.ports.create('root')
237- this.kernel.ports.bind(port, 'three')
238- this.kernel.ports.unbind('three')
239- try {
240- await this.kernel.send(port, this.kernel.createMessage())
241- } catch (e) {
242- t.pass()
243- }
244- }
245- }
246-
247- const hypervisor = new Hypervisor(node.dag)
248-
249- hypervisor.registerContainer('root', Root)
250- const root = await hypervisor.createInstance('root')
251- await root.run()
252-
253- t.deepEquals(root.state, {
254- '/': {
255- nonce: [1],
256- ports: {}
257- }
258- })
259- })
260-
261234 tape('message should arrive in the correct oder if sent in order', async t => {
262235 t.plan(2)
263236
264237 class Root extends BaseContainer {

Built with git-ssb-web