Skip to content

Commit b8ce817

Browse files
authored
Merge pull request #98 from bews/bews/timeout
Ping timeout fix - #96
2 parents c02220d + de9e980 commit b8ce817

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/connection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ Connection.prototype.end = function(data, had_error) {
223223
}
224224

225225
if (this.transport) {
226-
this.transport.close();
226+
this.transport.close(!!had_error);
227227
}
228228
};
229229

src/transports/net.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ Connection.prototype.disposeSocket = function() {
188188
};
189189

190190

191-
Connection.prototype.close = function() {
191+
Connection.prototype.close = function(force) {
192192
// Cleanly close the socket if we can
193-
if (this.socket && this.state === SOCK_CONNECTING) {
193+
if ((this.socket && this.state === SOCK_CONNECTING) || force) {
194194
this.debugOut('close() destroying');
195195
this.socket.destroy();
196196
} else if (this.socket && this.state === SOCK_CONNECTED) {

0 commit comments

Comments
 (0)