Skip to content

Commit c9a2c5e

Browse files
committed
use symbol for storing destroyingOnFinish flag
1 parent 7b5a01a commit c9a2c5e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/net.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ const DEFAULT_IPV6_ADDR = '::';
152152
const noop = () => {};
153153

154154
const kPerfHooksNetConnectContext = Symbol('kPerfHooksNetConnectContext');
155+
const kDestroyingOnFinish = Symbol('kDestroyingOnFinish');
155156

156157
const dc = require('diagnostics_channel');
157158
const netClientSocketChannel = dc.channel('net.client.socket');
@@ -795,17 +796,17 @@ function onReadableStreamEnd() {
795796

796797

797798
Socket.prototype.destroySoon = function() {
798-
if (this.destroyingOnFinish) return;
799+
if (this[kDestroyingOnFinish]) return;
799800

800801
if (this.writable)
801802
this.end();
802803

803804
if (this.writableFinished)
804805
this.destroy();
805806
else {
806-
this.destroyingOnFinish = true;
807+
this[kDestroyingOnFinish] = true;
807808
this.once('finish', () => {
808-
this.destroyingOnFinish = false;
809+
this[kDestroyingOnFinish] = false;
809810
this.destroy();
810811
});
811812
}

0 commit comments

Comments
 (0)