Removed a couple deadlocks
This commit is contained in:
parent
38c99023ac
commit
adf3eef877
7 changed files with 899 additions and 1 deletions
|
|
@ -543,6 +543,8 @@ impl TorrentState {
|
|||
}
|
||||
PeerState::Queued | PeerState::Dead | PeerState::NotNeeded => {
|
||||
warn!("bug: peer was in a wrong state, ignoring it forever");
|
||||
// Prevent deadlocks.
|
||||
drop(pe);
|
||||
self.peers.drop_peer(handle);
|
||||
return;
|
||||
}
|
||||
|
|
@ -563,6 +565,9 @@ impl TorrentState {
|
|||
pe.value_mut().state = PeerState::Dead;
|
||||
let backoff = pe.value_mut().stats.backoff.next_backoff();
|
||||
|
||||
// Prevent deadlocks.
|
||||
drop(pe);
|
||||
|
||||
if let Some(dur) = backoff {
|
||||
let state = self.clone();
|
||||
spawn(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue