Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
protocol/connections: noting not using the address during connected
Fintan Halpenny committed 3 months ago
commit 9446a4db75e6398dbca258c28d1c8d634a51b13c
parent b4803fb224a82b13f98d434cf7e1048fd823306e
1 file changed +15 -4
modified crates/radicle-protocol/src/connections/state.rs
@@ -247,13 +247,18 @@ impl Connections {
                        let session = self.sessions.inbound(node, addr, connection_type, now);
                        event::Connected::established(session)
                    }
-
                    Some(session) => event::Connected::established(session),
+
                    Some(session) => {
+
                        // TODO(finto): the address was never used in the
+
                        // previous code in the case of the link being outbound
+
                        // – it assumes that the session's address is the same
+
                        debug_assert_eq!(session.address(), &addr);
+
                        event::Connected::established(session)
+
                    }
                }
            }
-
            // TODO(finto): why was the address never used? Or did I miss something
            command::Connected::Outbound {
                node,
-
                addr: _,
+
                addr,
                connection_type,
            } => {
                if let Some(event) =
@@ -269,7 +274,13 @@ impl Connections {
                    connection_type,
                ) {
                    None => event::Connected::missing(node),
-
                    Some(session) => event::Connected::established(session),
+
                    Some(session) => {
+
                        // TODO(finto): the address was never used in the
+
                        // previous code in the case of the link being outbound
+
                        // – it assumes that the session's address is the same
+
                        debug_assert_eq!(session.address(), &addr);
+
                        event::Connected::established(session)
+
                    }
                }
            }
        }