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

rename connect timeout methods

  • Loading branch information
feross committed Mar 29, 2016
commit e4d30a99136c0ae6eb2611bf6e7097e22ccc7fd6
@@ -21,7 +21,7 @@ exports.createWebRTCPeer = function (conn, swarm) {
} else {
peer.conn.once('connect', function () { peer.onConnect() })
peer.conn.once('error', function (err) { peer.destroy(err) })
peer.setConnectTimeout()
peer.startConnectTimeout()
}

return peer
@@ -139,7 +139,7 @@ Peer.prototype.onConnect = function () {
wire.once('handshake', function (infoHash, peerId) {
self.onHandshake(infoHash, peerId)
})
self.setHandshakeTimeout()
self.startHandshakeTimeout()

conn.pipe(wire).pipe(conn)
if (self.swarm && !self.sentHandshake) self.handshake()
@@ -201,7 +201,7 @@ Peer.prototype.handshake = function () {
self.sentHandshake = true
}

Peer.prototype.setConnectTimeout = function () {
Peer.prototype.startConnectTimeout = function () {
var self = this
clearTimeout(self.connectTimeout)
self.connectTimeout = setTimeout(function () {
@@ -210,7 +210,7 @@ Peer.prototype.setConnectTimeout = function () {
if (self.connectTimeout.unref) self.connectTimeout.unref()
}

Peer.prototype.setHandshakeTimeout = function () {
Peer.prototype.startHandshakeTimeout = function () {
var self = this
clearTimeout(self.handshakeTimeout)
self.handshakeTimeout = setTimeout(function () {
@@ -359,7 +359,7 @@ Swarm.prototype._drain = function () {

conn.once('connect', function () { peer.onConnect() })
conn.once('error', function (err) { peer.destroy(err) })
peer.setConnectTimeout()
peer.startConnectTimeout()

// When connection closes, attempt reconnect after timeout (with exponential backoff)
conn.on('close', function () {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.