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
|
||||
}
|
||||
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()
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -1231,10 +1231,8 @@ func (t *Torrent) deleteConnection(c *connection) (ret bool) {
|
|||
}
|
||||
|
||||
func (t *Torrent) assertNoPendingRequests() {
|
||||
for _, num := range t.pendingRequests {
|
||||
if num != 0 {
|
||||
panic(num)
|
||||
}
|
||||
if len(t.pendingRequests) != 0 {
|
||||
panic(t.pendingRequests)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue