mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2024-12-14 03:16:24 +00:00
fix crash, oops
This commit is contained in:
parent
69e8528cb4
commit
5aa0696a34
@ -44,7 +44,7 @@ Swarm.prototype.scrape = function (params, cb) {
|
|||||||
Swarm.prototype._onAnnounceStarted = function (params, peer) {
|
Swarm.prototype._onAnnounceStarted = function (params, peer) {
|
||||||
if (peer) {
|
if (peer) {
|
||||||
debug('unexpected `started` event from peer that is already in swarm')
|
debug('unexpected `started` event from peer that is already in swarm')
|
||||||
return this._onAnnounce_update(params, peer) // treat as an update
|
return this._onAnnounceUpdate(params, peer) // treat as an update
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.left === 0) this.complete += 1
|
if (params.left === 0) this.complete += 1
|
||||||
@ -72,7 +72,7 @@ Swarm.prototype._onAnnounceStopped = function (params, peer) {
|
|||||||
Swarm.prototype._onAnnounceCompleted = function (params, peer) {
|
Swarm.prototype._onAnnounceCompleted = function (params, peer) {
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
debug('unexpected `completed` event from peer that is not in swarm')
|
debug('unexpected `completed` event from peer that is not in swarm')
|
||||||
return this._onAnnounce_started(params, peer) // treat as a start
|
return this._onAnnounceStarted(params, peer) // treat as a start
|
||||||
}
|
}
|
||||||
if (peer.complete) {
|
if (peer.complete) {
|
||||||
debug('unexpected `completed` event from peer that is already marked as completed')
|
debug('unexpected `completed` event from peer that is already marked as completed')
|
||||||
@ -87,7 +87,7 @@ Swarm.prototype._onAnnounceCompleted = function (params, peer) {
|
|||||||
Swarm.prototype._onAnnounceUpdate = function (params, peer) {
|
Swarm.prototype._onAnnounceUpdate = function (params, peer) {
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
debug('unexpected `update` event from peer that is not in swarm')
|
debug('unexpected `update` event from peer that is not in swarm')
|
||||||
return this._onAnnounce_started(params, peer) // treat as a start
|
return this._onAnnounceStarted(params, peer) // treat as a start
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!peer.complete && params.left === 0) {
|
if (!peer.complete && params.left === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user