Skip to content

Commit

Permalink
added con with all printer
Browse files Browse the repository at this point in the history
  • Loading branch information
mh0lt committed Jul 3, 2024
1 parent f3a099b commit 4b15ef4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,9 @@ func (t *Torrent) deletePeerConn(c *PeerConn, lock bool) (ret bool) {
c.deleteAllRequests("Torrent.deletePeerConn", false)
t.assertPendingRequests(false)
if t.numActivePeers() == 0 && len(t.connsWithAllPieces) != 0 {
for p := range t.connsWithAllPieces {
fmt.Println("CWAP", p.String())
}
panic(fmt.Sprintf("no active peers, but %d conns with all", len(t.connsWithAllPieces)))
}
return
Expand Down Expand Up @@ -3451,6 +3454,7 @@ func (t *Torrent) requestingPeer(r RequestIndex, lock bool) *Peer {
}

func (t *Torrent) addConnWithAllPieces(p *Peer, lock bool) {
fmt.Println("+CWAP", p.String())
if lock {
t.mu.Lock()
defer t.mu.Unlock()
Expand All @@ -3463,6 +3467,7 @@ func (t *Torrent) addConnWithAllPieces(p *Peer, lock bool) {
}

func (t *Torrent) deleteConnWithAllPieces(p *Peer, lock bool) bool {
fmt.Println("-CWAP", p.String())
if lock {
t.mu.Lock()
defer t.mu.Unlock()
Expand Down

0 comments on commit 4b15ef4

Please sign in to comment.