|
|
@ -680,7 +680,7 @@ impl Broker { |
|
|
|
.or_insert(HashSet::with_capacity(1)); |
|
|
|
.or_insert(HashSet::with_capacity(1)); |
|
|
|
|
|
|
|
|
|
|
|
if !peers_set.insert(peer) { |
|
|
|
if !peers_set.insert(peer) { |
|
|
|
return Err(ProtocolError::PeerAlreadyConnected); |
|
|
|
//return Err(ProtocolError::PeerAlreadyConnected);
|
|
|
|
} |
|
|
|
} |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|
} |
|
|
|
} |
|
|
@ -762,13 +762,14 @@ impl Broker { |
|
|
|
) -> Result<(), ProtocolError> { |
|
|
|
) -> Result<(), ProtocolError> { |
|
|
|
log_debug!("ATTACH PEER_ID {:?}", remote_peer_id); |
|
|
|
log_debug!("ATTACH PEER_ID {:?}", remote_peer_id); |
|
|
|
|
|
|
|
|
|
|
|
let already = self.peers.get(&(None, Some(remote_peer_id))); |
|
|
|
let already = self.peers.remove(&(None, Some(remote_peer_id))); |
|
|
|
if already.is_some() { |
|
|
|
if already.is_some() { |
|
|
|
match already.unwrap().connected { |
|
|
|
match already.unwrap().connected { |
|
|
|
PeerConnection::NONE => {} |
|
|
|
PeerConnection::NONE => {} |
|
|
|
_ => { |
|
|
|
PeerConnection::Client(mut cnx) => { |
|
|
|
return Err(ProtocolError::PeerAlreadyConnected); |
|
|
|
cnx.close().await; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
_ => {} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|