mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 18:24:36 +00:00
fix ospf route (#970)
- **fix deadlock in ospf route introducd by #958 ** - **use random peer id for foreign network entry, because ospf route algo need peer id change after peer info version reset. this may interfere route propagation and cause node residual** - **allow multiple nodes broadcast same network ranges for subnet proxy** - **bump version to v2.3.2**
This commit is contained in:
@@ -266,6 +266,31 @@ impl PeerConn {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(handshake_recved))]
|
||||
pub async fn do_handshake_as_server_ext<Fn>(
|
||||
&mut self,
|
||||
mut handshake_recved: Fn,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
Fn: FnMut(&mut Self, &HandshakeRequest) -> Result<(), Error> + Send,
|
||||
{
|
||||
let rsp = self.wait_handshake_loop().await?;
|
||||
|
||||
handshake_recved(self, &rsp)?;
|
||||
|
||||
tracing::info!("handshake request: {:?}", rsp);
|
||||
self.info = Some(rsp);
|
||||
self.is_client = Some(false);
|
||||
|
||||
self.send_handshake().await?;
|
||||
|
||||
if self.get_peer_id() == self.my_peer_id {
|
||||
Err(Error::WaitRespError("peer id conflict".to_owned()))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[tracing::instrument]
|
||||
pub async fn do_handshake_as_server(&mut self) -> Result<(), Error> {
|
||||
let rsp = self.wait_handshake_loop().await?;
|
||||
@@ -435,6 +460,17 @@ impl PeerConn {
|
||||
is_closed: self.close_event_notifier.is_closed(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_peer_id(&mut self, peer_id: PeerId) {
|
||||
if self.info.is_some() {
|
||||
panic!("set_peer_id should only be called before handshake");
|
||||
}
|
||||
self.my_peer_id = peer_id;
|
||||
}
|
||||
|
||||
pub fn get_my_peer_id(&self) -> PeerId {
|
||||
self.my_peer_id
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for PeerConn {
|
||||
|
||||
Reference in New Issue
Block a user