Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

uWTT doesnot close sockets and not update active peers on announce: update #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Vladislavik
Copy link

There is 2 bugs:

  1. _onAnnounceStopped (params, peer, id) {

    new connections after some time of work cant accept, becourse of uWTT doesnot close used sockets, i think it need be added in section (_onAnnounceStopped) it called when peer close connection, and when it removed by maxAge:
 _onAnnounceStopped (params, peer, id) {
...
     if(peer.socket){
          peer.socket = null
     }
}
  1. this.peers.set(id, peer)

    this.peers.set(id, peer) should not be included in if(!peer.complete && params.left === 0) becourse peers will be deleted after maxAge, and never beed updated by "announce update", like in Bittorent-tracker
    https://github.com/webtorrent/bittorrent-tracker/blob/19a363dde9c0a369655dfcd253db437cc8a84229/lib/server/swarm.js#L132 like this:
  _onAnnounceUpdate (params, peer, id) {
    if (!peer) {
      debug('unexpected `update` event from peer that is not in swarm')
      return this._onAnnounceStarted(params, peer, id) // treat as a start
    }

    if (!peer.complete && params.left === 0) {
      this.complete += 1
      this.incomplete -= 1
      peer.complete = true
    }
      this.peers.set(id, peer)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant