From b2cbfafae7f442eba37e52a995e7f24766c90c1c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 16 Sep 2016 07:49:29 -0700 Subject: [PATCH] use 'once' on some event handlers --- lib/client/websocket-tracker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/client/websocket-tracker.js b/lib/client/websocket-tracker.js index b0aa6b5..3cd7d1f 100644 --- a/lib/client/websocket-tracker.js +++ b/lib/client/websocket-tracker.js @@ -169,12 +169,12 @@ WebSocketTracker.prototype._openSocket = function () { } else { self.socket = socketPool[self.announceUrl] = new Socket(self.announceUrl) self.socket.consumers = 1 - self.socket.on('connect', self._onSocketConnectBound) + self.socket.once('connect', self._onSocketConnectBound) } self.socket.on('data', self._onSocketDataBound) - self.socket.on('close', self._onSocketCloseBound) - self.socket.on('error', self._onSocketErrorBound) + self.socket.once('close', self._onSocketCloseBound) + self.socket.once('error', self._onSocketErrorBound) } WebSocketTracker.prototype._onSocketConnect = function () {