use 'once' on some event handlers

This commit is contained in:
Feross Aboukhadijeh 2016-09-16 07:49:29 -07:00
parent d5161e6ce5
commit b2cbfafae7

View File

@ -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 () {