make server and client always send { action: 'announce' }

This commit is contained in:
Feross Aboukhadijeh 2016-03-23 22:04:07 -07:00
parent 2fffdc6730
commit 721a7bea7c
2 changed files with 3 additions and 0 deletions

View File

@ -247,6 +247,7 @@ WebSocketTracker.prototype._onAnnounceResponse = function (data) {
peer.id = common.binaryToHex(data.peer_id)
peer.once('signal', function (answer) {
var params = {
action: 'announce',
info_hash: self.client._infoHashBinary,
peer_id: self.client._peerIdBinary,
to_peer_id: data.peer_id,

View File

@ -369,6 +369,7 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) {
debug('got %s peers from swarm %s', peers.length, params.info_hash)
peers.forEach(function (peer, i) {
peer.socket.send(JSON.stringify({
action: 'announce',
offer: params.offers[i].offer,
offer_id: params.offers[i].offer_id,
peer_id: common.hexToBinary(params.peer_id),
@ -392,6 +393,7 @@ Server.prototype._onWebSocketRequest = function (socket, opts, params) {
}
toPeer.socket.send(JSON.stringify({
action: 'announce',
answer: params.answer,
offer_id: params.offer_id,
peer_id: common.hexToBinary(params.peer_id),