Fixed overflow panic in handshake_panic (#2495)
This commit is contained in:
parent
5f0ed9ddce
commit
533af43313
@ -591,7 +591,8 @@ impl Host {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn handshake_count(&self) -> usize {
|
fn handshake_count(&self) -> usize {
|
||||||
self.sessions.read().count() - self.session_count()
|
// session_count < total_count is possible because of the data race.
|
||||||
|
self.sessions.read().count().saturating_sub(self.session_count())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn keep_alive(&self, io: &IoContext<NetworkIoMessage>) {
|
fn keep_alive(&self, io: &IoContext<NetworkIoMessage>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user