mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-13 02:46:29 +00:00
ws client: ignore offers/answers from self
This commit is contained in:
parent
a80f2559e7
commit
bb145cce14
@ -38,6 +38,8 @@ function Client (peerId, port, torrent, opts) {
|
||||
? peerId
|
||||
: new Buffer(peerId, 'hex')
|
||||
self._port = port
|
||||
self._peerIdHex = self._peerId.toString('hex')
|
||||
|
||||
self._infoHash = Buffer.isBuffer(torrent.infoHash)
|
||||
? torrent.infoHash
|
||||
: new Buffer(torrent.infoHash, 'hex')
|
||||
|
@ -145,6 +145,11 @@ WebSocketTracker.prototype._onSocketData = function (data) {
|
||||
})
|
||||
}
|
||||
|
||||
if (self.client._peerIdHex === common.binaryToHex(data.peer_id)) {
|
||||
// ignore offers/answers from this client
|
||||
return
|
||||
}
|
||||
|
||||
var peer
|
||||
if (data.offer) {
|
||||
peer = new Peer({
|
||||
|
Loading…
Reference in New Issue
Block a user