Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fixed overflow panic in handshake_panic (#2495)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar authored Oct 7, 2016
1 parent 5f0ed9d commit 533af43
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion util/network/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ impl Host {
}

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>) {
Expand Down

0 comments on commit 533af43

Please sign in to comment.