Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate bittorrent-swarm, inline into webtorrent #704

Merged
merged 9 commits into from Mar 29, 2016

Shorter connect timeout for TCP peers

This restores the older timeout for TCP peers, which was originally
increased as a workaround to give enough time for WebRTC peers.

Supersedes https://github.com/feross/bittorrent-swarm/pull/21
  • Loading branch information
feross committed Mar 29, 2016
commit 5360418d2a331f0cf00bcf1cf6dc819758f6aa17
@@ -3,7 +3,8 @@ var Wire = require('bittorrent-protocol')

var WebConn = require('./webconn')

var CONNECT_TIMEOUT = 25000
var CONNECT_TIMEOUT_TCP = 25000
var CONNECT_TIMEOUT_WEBRTC = 5000
var HANDSHAKE_TIMEOUT = 25000

/**
@@ -206,7 +207,7 @@ Peer.prototype.startConnectTimeout = function () {
clearTimeout(self.connectTimeout)
self.connectTimeout = setTimeout(function () {
self.destroy(new Error('connect timeout'))
}, CONNECT_TIMEOUT)
}, self.type === 'webrtc' ? CONNECT_TIMEOUT_WEBRTC : CONNECT_TIMEOUT_TCP)
if (self.connectTimeout.unref) self.connectTimeout.unref()
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.