Merge pull request #377 from ethcore/net

beta: Check for handshake expiration before attempting replace
This commit is contained in:
Gav Wood 2016-02-08 16:21:31 +01:00
commit ac218dc502
2 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,8 @@ branches:
- master - master
- /^beta-.*$/ - /^beta-.*$/
- /^stable-.*$/ - /^stable-.*$/
- /^beta$/
- /^stable$/
matrix: matrix:
fast_finish: true fast_finish: true
include: include:

View File

@ -599,6 +599,9 @@ impl<Message> Host<Message> where Message: Send + Sync + Clone {
fn start_session(&self, token: StreamToken, io: &IoContext<NetworkIoMessage<Message>>) { fn start_session(&self, token: StreamToken, io: &IoContext<NetworkIoMessage<Message>>) {
let mut connections = self.connections.write().unwrap(); let mut connections = self.connections.write().unwrap();
if connections.get(token).is_none() {
return; // handshake expired
}
connections.replace_with(token, |c| { connections.replace_with(token, |c| {
match Arc::try_unwrap(c).ok().unwrap().into_inner().unwrap() { match Arc::try_unwrap(c).ok().unwrap().into_inner().unwrap() {
ConnectionEntry::Handshake(h) => { ConnectionEntry::Handshake(h) => {