Rework Torrent pending requests assertions
Should provide more info, and sooner for #249.
This commit is contained in:
parent
0caafd8e87
commit
174120e1e8
|
@ -1369,7 +1369,15 @@ func (c *connection) deleteRequest(r request) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
delete(c.requests, r)
|
delete(c.requests, r)
|
||||||
c.t.pendingRequests[r]--
|
pr := c.t.pendingRequests
|
||||||
|
pr[r]--
|
||||||
|
n := pr[r]
|
||||||
|
if n == 0 {
|
||||||
|
delete(pr, r)
|
||||||
|
}
|
||||||
|
if n < 0 {
|
||||||
|
panic(n)
|
||||||
|
}
|
||||||
c.updateRequests()
|
c.updateRequests()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1231,10 +1231,8 @@ func (t *Torrent) deleteConnection(c *connection) (ret bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Torrent) assertNoPendingRequests() {
|
func (t *Torrent) assertNoPendingRequests() {
|
||||||
for _, num := range t.pendingRequests {
|
if len(t.pendingRequests) != 0 {
|
||||||
if num != 0 {
|
panic(t.pendingRequests)
|
||||||
panic(num)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue