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

Commit

Permalink
Merge pull request #375 from ethcore/net
Browse files Browse the repository at this point in the history
Check for handshake expiration before attempting connection replace
  • Loading branch information
Gav Wood committed Feb 8, 2016
2 parents 666a1c3 + b411a3d commit 76d51a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions util/src/network/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {

fn start_session(&self, token: StreamToken, io: &IoContext<NetworkIoMessage<Message>>) {
let mut connections = self.connections.write().unwrap();
if connections.get(token).is_none() {
return; // handshake expired
}
connections.replace_with(token, |c| {
match Arc::try_unwrap(c).ok().unwrap().into_inner().unwrap() {
ConnectionEntry::Handshake(h) => {
Expand Down

0 comments on commit 76d51a3

Please sign in to comment.