From c4ee7aae36e4dc459d15b7d07fe1c901327a06c0 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 22 Jul 2015 16:30:52 -0700 Subject: [PATCH] fix thrown exception when websocket connection is aborted alternative to https://github.com/feross/bittorrent-tracker/pull/89 --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 5287cdf..35b4d36 100644 --- a/server.js +++ b/server.js @@ -331,7 +331,7 @@ Server.prototype._onWebSocketRequest = function (socket, params) { offer_id: params.offers[i].offer_id, peer_id: common.hexToBinary(params.peer_id), info_hash: common.hexToBinary(params.info_hash) - })) + }), peer.socket.onSend) debug('sent offer to %s from %s', peer.peerId, params.peer_id) }) } @@ -353,7 +353,7 @@ Server.prototype._onWebSocketRequest = function (socket, params) { offer_id: params.offer_id, peer_id: common.hexToBinary(params.peer_id), info_hash: common.hexToBinary(params.info_hash) - })) + }), toPeer.socket.onSend) debug('sent answer to %s from %s', toPeer.peerId, params.peer_id) }