| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0b0370f commit ea4be72
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,11 +13,11 @@ class SocketListSend extends EventEmitter { | |||
| 13 | 13 | child.once('exit', () => this.emit('exit', this)); | |
| 14 | 14 | } | |
| 15 | 15 | ||
| 16 | - _request(msg, cmd, callback) { | ||
| 16 | + _request(msg, cmd, swallowErrors, callback) { | ||
| 17 | 17 | var self = this; | |
| 18 | 18 | ||
| 19 | 19 | if (!this.child.connected) return onclose(); | |
| 20 | - this.child.send(msg); | ||
| 20 | + this.child._send(msg, undefined, swallowErrors); | ||
| 21 | 21 | ||
| 22 | 22 | function onclose() { | |
| 23 | 23 | self.child.removeListener('internalMessage', onreply); | |
@@ -40,14 +40,14 @@ class SocketListSend extends EventEmitter { | |||
| 40 | 40 | this._request({ | |
| 41 | 41 | cmd: 'NODE_SOCKET_NOTIFY_CLOSE', | |
| 42 | 42 | key: this.key | |
| 43 | - }, 'NODE_SOCKET_ALL_CLOSED', callback); | ||
| 43 | + }, 'NODE_SOCKET_ALL_CLOSED', true, callback); | ||
| 44 | 44 | } | |
| 45 | 45 | ||
| 46 | 46 | getConnections(callback) { | |
| 47 | 47 | this._request({ | |
| 48 | 48 | cmd: 'NODE_SOCKET_GET_COUNT', | |
| 49 | 49 | key: this.key | |
| 50 | - }, 'NODE_SOCKET_COUNT', function(err, msg) { | ||
| 50 | + }, 'NODE_SOCKET_COUNT', false, function(err, msg) { | ||
| 51 | 51 | if (err) return callback(err); | |
| 52 | 52 | callback(null, msg.count); | |
| 53 | 53 | }); | |
@@ -67,10 +67,10 @@ class SocketListReceive extends EventEmitter { | |||
| 67 | 67 | function onempty(self) { | |
| 68 | 68 | if (!self.child.connected) return; | |
| 69 | 69 | ||
| 70 | - self.child.send({ | ||
| 70 | + self.child._send({ | ||
| 71 | 71 | cmd: 'NODE_SOCKET_ALL_CLOSED', | |
| 72 | 72 | key: self.key | |
| 73 | - }); | ||
| 73 | + }, undefined, true); | ||
| 74 | 74 | } | |
| 75 | 75 | ||
| 76 | 76 | this.child.on('internalMessage', (msg) => { | |
@@ -84,7 +84,7 @@ class SocketListReceive extends EventEmitter { | |||
| 84 | 84 | this.once('empty', onempty); | |
| 85 | 85 | } else if (msg.cmd === 'NODE_SOCKET_GET_COUNT') { | |
| 86 | 86 | if (!this.child.connected) return; | |
| 87 | - this.child.send({ | ||
| 87 | + this.child._send({ | ||
| 88 | 88 | cmd: 'NODE_SOCKET_COUNT', | |
| 89 | 89 | key: this.key, | |
| 90 | 90 | count: this.connections | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ prefix parallel | |||
| 7 | 7 | [true] # This section applies to all platforms | |
| 8 | 8 | ||
| 9 | 9 | [$system==win32] | |
| 10 | - test-child-process-fork-net-socket: PASS,FLAKY | ||
| 11 | 10 | ||
| 12 | 11 | [$system==linux] | |
| 13 | 12 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ const key = 'test-key'; | |||
| 12 | 12 | { | |
| 13 | 13 | const child = Object.assign(new EventEmitter(), { | |
| 14 | 14 | connected: false, | |
| 15 | - send: common.mustNotCall() | ||
| 15 | + _send: common.mustNotCall() | ||
| 16 | 16 | }); | |
| 17 | 17 | ||
| 18 | 18 | const list = new SocketListReceive(child, key); | |
@@ -24,7 +24,7 @@ const key = 'test-key'; | |||
| 24 | 24 | { | |
| 25 | 25 | const child = Object.assign(new EventEmitter(), { | |
| 26 | 26 | connected: true, | |
| 27 | - send: common.mustCall((msg) => { | ||
| 27 | + _send: common.mustCall((msg) => { | ||
| 28 | 28 | assert.strictEqual(msg.cmd, 'NODE_SOCKET_ALL_CLOSED'); | |
| 29 | 29 | assert.strictEqual(msg.key, key); | |
| 30 | 30 | }) | |
@@ -38,7 +38,7 @@ const key = 'test-key'; | |||
| 38 | 38 | { | |
| 39 | 39 | const child = Object.assign(new EventEmitter(), { | |
| 40 | 40 | connected: true, | |
| 41 | - send: common.mustCall((msg) => { | ||
| 41 | + _send: common.mustCall((msg) => { | ||
| 42 | 42 | assert.strictEqual(msg.cmd, 'NODE_SOCKET_COUNT'); | |
| 43 | 43 | assert.strictEqual(msg.key, key); | |
| 44 | 44 | assert.strictEqual(msg.count, 0); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,7 @@ const key = 'test-key'; | |||
| 16 | 16 | ||
| 17 | 17 | const list = new SocketListSend(child, 'test'); | |
| 18 | 18 | ||
| 19 | - list._request('msg', 'cmd', common.mustCall((err) => { | ||
| 19 | + list._request('msg', 'cmd', false, common.mustCall((err) => { | ||
| 20 | 20 | common.expectsError({ | |
| 21 | 21 | code: 'ERR_CHILD_CLOSED_BEFORE_REPLY', | |
| 22 | 22 | type: Error, | |
@@ -30,7 +30,7 @@ const key = 'test-key'; | |||
| 30 | 30 | { | |
| 31 | 31 | const child = Object.assign(new EventEmitter(), { | |
| 32 | 32 | connected: true, | |
| 33 | - send: function(msg) { | ||
| 33 | + _send: function(msg) { | ||
| 34 | 34 | process.nextTick(() => | |
| 35 | 35 | this.emit('internalMessage', { key, cmd: 'cmd' }) | |
| 36 | 36 | ); | |
@@ -39,7 +39,7 @@ const key = 'test-key'; | |||
| 39 | 39 | ||
| 40 | 40 | const list = new SocketListSend(child, key); | |
| 41 | 41 | ||
| 42 | - list._request('msg', 'cmd', common.mustCall((err, msg) => { | ||
| 42 | + list._request('msg', 'cmd', false, common.mustCall((err, msg) => { | ||
| 43 | 43 | assert.strictEqual(err, null); | |
| 44 | 44 | assert.strictEqual(msg.cmd, 'cmd'); | |
| 45 | 45 | assert.strictEqual(msg.key, key); | |
@@ -53,12 +53,12 @@ const key = 'test-key'; | |||
| 53 | 53 | { | |
| 54 | 54 | const child = Object.assign(new EventEmitter(), { | |
| 55 | 55 | connected: true, | |
| 56 | - send: function(msg) { process.nextTick(() => this.emit('disconnect')); } | ||
| 56 | + _send: function(msg) { process.nextTick(() => this.emit('disconnect')); } | ||
| 57 | 57 | }); | |
| 58 | 58 | ||
| 59 | 59 | const list = new SocketListSend(child, key); | |
| 60 | 60 | ||
| 61 | - list._request('msg', 'cmd', common.mustCall((err) => { | ||
| 61 | + list._request('msg', 'cmd', false, common.mustCall((err) => { | ||
| 62 | 62 | common.expectsError({ | |
| 63 | 63 | code: 'ERR_CHILD_CLOSED_BEFORE_REPLY', | |
| 64 | 64 | type: Error, | |
@@ -73,7 +73,7 @@ const key = 'test-key'; | |||
| 73 | 73 | { | |
| 74 | 74 | const child = Object.assign(new EventEmitter(), { | |
| 75 | 75 | connected: true, | |
| 76 | - send: function(msg) { | ||
| 76 | + _send: function(msg) { | ||
| 77 | 77 | assert.strictEqual(msg.cmd, 'NODE_SOCKET_NOTIFY_CLOSE'); | |
| 78 | 78 | assert.strictEqual(msg.key, key); | |
| 79 | 79 | process.nextTick(() => | |
@@ -98,7 +98,7 @@ const key = 'test-key'; | |||
| 98 | 98 | const count = 1; | |
| 99 | 99 | const child = Object.assign(new EventEmitter(), { | |
| 100 | 100 | connected: true, | |
| 101 | - send: function(msg) { | ||
| 101 | + _send: function(msg) { | ||
| 102 | 102 | assert.strictEqual(msg.cmd, 'NODE_SOCKET_GET_COUNT'); | |
| 103 | 103 | assert.strictEqual(msg.key, key); | |
| 104 | 104 | process.nextTick(() => | |
@@ -127,7 +127,7 @@ const key = 'test-key'; | |||
| 127 | 127 | const count = 1; | |
| 128 | 128 | const child = Object.assign(new EventEmitter(), { | |
| 129 | 129 | connected: true, | |
| 130 | - send: function() { | ||
| 130 | + _send: function() { | ||
| 131 | 131 | process.nextTick(() => { | |
| 132 | 132 | this.emit('disconnect'); | |
| 133 | 133 | this.emit('internalMessage', { key, count, cmd: 'NODE_SOCKET_COUNT' }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments