summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/net.js2
-rw-r--r--test/parallel/test-tls-invoke-queued.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/net.js b/lib/net.js
index 8ef0b6a6d7..503946047d 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -790,6 +790,8 @@ function afterWrite(status, handle, err) {
// callback may come after call to destroy.
if (self.destroyed) {
debug('afterWrite destroyed');
+ if (this.callback)
+ this.callback(null);
return;
}
diff --git a/test/parallel/test-tls-invoke-queued.js b/test/parallel/test-tls-invoke-queued.js
index 754b02ba0b..482ab84735 100644
--- a/test/parallel/test-tls-invoke-queued.js
+++ b/test/parallel/test-tls-invoke-queued.js
@@ -40,8 +40,8 @@ const server = tls.createServer({
c.write('world!', null, common.mustCall(function() {
c.destroy();
}));
- // Data on next _write() will be written but callback will not be invoked
- c.write(' gosh', null, common.mustNotCall());
+ // Data on next _write() will be written, and the cb will still be invoked
+ c.write(' gosh', null, common.mustCall());
}));
server.close();