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 #722 from ethcore/network
Browse files Browse the repository at this point in the history
Fixed handshake leak
  • Loading branch information
arkpar committed Mar 14, 2016
2 parents 38de95c + c8b65c7 commit d844de4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/src/network/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,8 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
if h.expired {
return;
}
io.deregister_stream(token).expect("Error deleting handshake registration");
h.set_expired();
let originated = h.originated;
let mut session = match Session::new(&mut h, &self.info.read().unwrap()) {
Ok(s) => s,
Expand All @@ -705,8 +707,6 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
}
let result = sessions.insert_with(move |session_token| {
session.set_token(session_token);
io.deregister_stream(token).expect("Error deleting handshake registration");
h.set_expired();
io.register_stream(session_token).expect("Error creating session registration");
self.stats.inc_sessions();
trace!(target: "network", "Creating session {} -> {}", token, session_token);
Expand Down

0 comments on commit d844de4

Please sign in to comment.