fix thrown exception when websocket connection is aborted

alternative to https://github.com/feross/bittorrent-tracker/pull/89
This commit is contained in:
Feross Aboukhadijeh 2015-07-22 16:30:52 -07:00
parent e6f9989310
commit c4ee7aae36

View File

@ -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)
}