Skip to content

Commit

Permalink
Clear socket on MemJS.Server when connection is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
olemstrom committed Mar 13, 2023
1 parent 647a2e1 commit 3a12f97
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/memjs/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ Server.prototype.sock = function(sasl, go) {
self.error(error);
});

self._socket.on('close', function() {
self.connected = false;
if (self.timeoutSet) {
self._socket.setTimeout(0);
self.timeoutSet = false;
}
self._socket = undefined;
});

// setup connection timeout handler
self.timeoutSet = true;
self._socket.setTimeout(self.options.conntimeout * 1000, function() {
Expand Down

0 comments on commit 3a12f97

Please sign in to comment.