Remove exchanged overlay IP of peers

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2023-11-22 16:54:56 +01:00
parent 01eee45d80
commit a56f3fa7e7
3 changed files with 8 additions and 13 deletions
+6
View File
@@ -36,6 +36,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ignore retraction updates if the route table has an existing but retracted route already. This fixes
an issue where retracted routes would not be flushed from the routing table.
### Removed
- All uses of the exchanged overlay IP in the peer handshake are fully
removed. Handshake is still performed to stay backwards compatible
until the next breaking release.
## [0.1.2] - 2023-11-15
### Changed
-9
View File
@@ -51,7 +51,6 @@ impl Peer {
router_data_tx: mpsc::Sender<DataPacket>,
router_control_tx: mpsc::UnboundedSender<(ControlPacket, Peer)>,
stream: TcpStream,
overlay_ip: IpAddr,
dead_peer_sink: mpsc::Sender<Peer>,
) -> Result<Self, Box<dyn Error>> {
// Data channel for peer
@@ -67,7 +66,6 @@ impl Peer {
to_peer_data,
to_peer_control,
stream_ip,
overlay_ip,
}),
};
@@ -174,11 +172,6 @@ impl Peer {
self.inner.state.write().unwrap().time_last_received_hello = time
}
/// Get overlay IP for this peer
pub fn overlay_ip(&self) -> IpAddr {
self.inner.overlay_ip
}
/// For sending data packets towards a peer instance on this node.
/// It's send over the to_peer_data channel and read from the corresponding receiver.
/// The receiver sends the packet over the TCP stream towards the destined peer instance on another node
@@ -247,8 +240,6 @@ struct PeerInner {
to_peer_control: mpsc::UnboundedSender<ControlPacket>,
/// Used to identify peer based on its connection params
stream_ip: IpAddr,
// TODO: not needed
overlay_ip: IpAddr,
}
#[derive(Debug)]
+2 -4
View File
@@ -48,7 +48,7 @@ impl PeerManager {
info!("Failed to read hanshake from peer: {e}");
continue;
}
let received_overlay_ip = match buffer[0] {
let _ = match buffer[0] {
0 => IpAddr::from(
<&[u8] as TryInto<[u8; 4]>>::try_into(&buffer[1..5]).unwrap(),
),
@@ -77,7 +77,6 @@ impl PeerManager {
self.router.router_data_tx(),
self.router.router_control_tx(),
peer_stream,
received_overlay_ip,
self.router.dead_peer_sink().clone(),
) {
info!("Connected to new peer {}", new_peer.underlay_ip());
@@ -154,7 +153,7 @@ impl PeerManager {
stream.write_all(&buf).await?;
// Step 2
stream.read_exact(&mut buf).await?;
let received_overlay_ip = match buf[0] {
let _ = match buf[0] {
0 => IpAddr::from(<&[u8] as TryInto<[u8; 4]>>::try_into(&buf[1..5]).unwrap()),
1 => IpAddr::from(<&[u8] as TryInto<[u8; 16]>>::try_into(&buf[1..]).unwrap()),
_ => {
@@ -174,7 +173,6 @@ impl PeerManager {
router_data_tx,
router_control_tx,
stream,
received_overlay_ip,
dead_peer_sink,
)
}