| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e5c2675 commit dfbbfbb
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -410,6 +410,8 @@ function writeAfterFIN(chunk, encoding, cb) { | |||
| 410 | 410 | if (typeof cb === 'function') { | |
| 411 | 411 | defaultTriggerAsyncIdScope(this[async_id_symbol], process.nextTick, cb, er); | |
| 412 | 412 | } | |
| 413 | + | ||
| 414 | + return false; | ||
| 413 | 415 | } | |
| 414 | 416 | ||
| 415 | 417 | Socket.prototype.setTimeout = setStreamTimeout; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ const common = require('../common'); | |||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const net = require('net'); | |
| 6 | 6 | ||
| 7 | - const { mustCall } = common; | ||
| 7 | + const { expectsError, mustCall } = common; | ||
| 8 | 8 | ||
| 9 | 9 | // This test ensures those errors caused by calling `net.Socket.write()` | |
| 10 | 10 | // after sockets ending will be emitted in the next tick. | |
@@ -18,7 +18,13 @@ const server = net.createServer(mustCall((socket) => { | |||
| 18 | 18 | server.close(); | |
| 19 | 19 | })); | |
| 20 | 20 | client.on('end', mustCall(() => { | |
| 21 | - client.write('hello', mustCall()); | ||
| 21 | + const ret = client.write('hello', expectsError({ | ||
| 22 | + code: 'EPIPE', | ||
| 23 | + message: 'This socket has been ended by the other party', | ||
| 24 | + type: Error | ||
| 25 | + })); | ||
| 26 | + | ||
| 27 | + assert.strictEqual(ret, false); | ||
| 22 | 28 | assert(!hasError, 'The error should be emitted in the next tick.'); | |
| 23 | 29 | })); | |
| 24 | 30 | client.end(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments