mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-02-07 13:59:07 +00:00
make server and client always send { action: 'announce' }
This commit is contained in:
parent
2fffdc6730
commit
721a7bea7c
@ -247,6 +247,7 @@ WebSocketTracker.prototype._onAnnounceResponse = function (data) {
|
|||||||
peer.id = common.binaryToHex(data.peer_id)
|
peer.id = common.binaryToHex(data.peer_id)
|
||||||
peer.once('signal', function (answer) {
|
peer.once('signal', function (answer) {
|
||||||
var params = {
|
var params = {
|
||||||
|
action: 'announce',
|
||||||
info_hash: self.client._infoHashBinary,
|
info_hash: self.client._infoHashBinary,
|
||||||
peer_id: self.client._peerIdBinary,
|
peer_id: self.client._peerIdBinary,
|
||||||
to_peer_id: data.peer_id,
|
to_peer_id: data.peer_id,
|
||||||
|
@ -369,6 +369,7 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) {
|
|||||||
debug('got %s peers from swarm %s', peers.length, params.info_hash)
|
debug('got %s peers from swarm %s', peers.length, params.info_hash)
|
||||||
peers.forEach(function (peer, i) {
|
peers.forEach(function (peer, i) {
|
||||||
peer.socket.send(JSON.stringify({
|
peer.socket.send(JSON.stringify({
|
||||||
|
action: 'announce',
|
||||||
offer: params.offers[i].offer,
|
offer: params.offers[i].offer,
|
||||||
offer_id: params.offers[i].offer_id,
|
offer_id: params.offers[i].offer_id,
|
||||||
peer_id: common.hexToBinary(params.peer_id),
|
peer_id: common.hexToBinary(params.peer_id),
|
||||||
@ -392,6 +393,7 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toPeer.socket.send(JSON.stringify({
|
toPeer.socket.send(JSON.stringify({
|
||||||
|
action: 'announce',
|
||||||
answer: params.answer,
|
answer: params.answer,
|
||||||
offer_id: params.offer_id,
|
offer_id: params.offer_id,
|
||||||
peer_id: common.hexToBinary(params.peer_id),
|
peer_id: common.hexToBinary(params.peer_id),
|
||||||
|
Loading…
Reference in New Issue
Block a user