mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 10:31:36 +00:00
use 'once' on some event handlers
This commit is contained in:
parent
d5161e6ce5
commit
b2cbfafae7
@ -169,12 +169,12 @@ WebSocketTracker.prototype._openSocket = function () {
|
|||||||
} else {
|
} else {
|
||||||
self.socket = socketPool[self.announceUrl] = new Socket(self.announceUrl)
|
self.socket = socketPool[self.announceUrl] = new Socket(self.announceUrl)
|
||||||
self.socket.consumers = 1
|
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('data', self._onSocketDataBound)
|
||||||
self.socket.on('close', self._onSocketCloseBound)
|
self.socket.once('close', self._onSocketCloseBound)
|
||||||
self.socket.on('error', self._onSocketErrorBound)
|
self.socket.once('error', self._onSocketErrorBound)
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketTracker.prototype._onSocketConnect = function () {
|
WebSocketTracker.prototype._onSocketConnect = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user