fix: connectionReader could access self in its destructor after it has already the object has already been deleted if an error can be thrown from connectionMonitor while still on the stack from scanPackets
This commit is contained in:
parent
07f2dde0d5
commit
98b643b7ae
|
@ -417,6 +417,10 @@ struct Peer : NonCopyable {
|
|||
}
|
||||
}
|
||||
|
||||
//We cannot let an error be thrown from connectionMonitor while still on the stack from scanPackets in connectionReader
|
||||
//because then it would not call the destructor of connectionReader when connectionReader is cancelled.
|
||||
wait(delay(0));
|
||||
|
||||
if (peer->reliable.empty() && peer->unsent.empty()) {
|
||||
if (peer->peerReferences == 0 &&
|
||||
(peer->lastDataPacketSentTime < now() - FLOW_KNOBS->CONNECTION_MONITOR_UNREFERENCED_CLOSE_DELAY)) {
|
||||
|
|
Loading…
Reference in New Issue