Skip to content

Commit c4ee7aa

Browse files
committed
fix thrown exception when websocket connection is aborted
alternative to webtorrent#89
1 parent e6f9989 commit c4ee7aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ Server.prototype._onWebSocketRequest = function (socket, params) {
331331
offer_id: params.offers[i].offer_id,
332332
peer_id: common.hexToBinary(params.peer_id),
333333
info_hash: common.hexToBinary(params.info_hash)
334-
}))
334+
}), peer.socket.onSend)
335335
debug('sent offer to %s from %s', peer.peerId, params.peer_id)
336336
})
337337
}
@@ -353,7 +353,7 @@ Server.prototype._onWebSocketRequest = function (socket, params) {
353353
offer_id: params.offer_id,
354354
peer_id: common.hexToBinary(params.peer_id),
355355
info_hash: common.hexToBinary(params.info_hash)
356-
}))
356+
}), toPeer.socket.onSend)
357357
debug('sent answer to %s from %s', toPeer.peerId, params.peer_id)
358358
}
359359

0 commit comments

Comments
 (0)