Skip to content

Commit 3230675

Browse files
sanityclaude
andcommitted
fix: use pub_key() instead of peer() in connect tracing
The acceptor's PeerAddr is intentionally Unknown (NAT scenario) since the local peer doesn't know its external address yet. Use pub_key() instead of peer() to avoid panics on unknown addresses. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ad41b27 commit 3230675

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

crates/core/src/operations/connect.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ impl RelayState {
320320
// Use the joiner with updated observed address for response routing
321321
actions.response_target = Some(self.request.joiner.clone());
322322
tracing::info!(
323-
acceptor_peer = %acceptor.peer(),
324-
joiner_peer = %self.request.joiner.peer(),
323+
acceptor_pub_key = %acceptor.pub_key(),
324+
joiner_pub_key = %self.request.joiner.pub_key(),
325325
acceptor_loc = ?acceptor.location,
326326
joiner_loc = ?self.request.joiner.location,
327327
ring_distance = ?dist,
@@ -830,12 +830,9 @@ impl Operation for ConnectOp {
830830
};
831831
// Route through upstream (where the request came from) since we may
832832
// not have a direct connection to the target
833-
if let Some(upstream) = &source_addr {
833+
if let Some(upstream) = source_addr {
834834
network_bridge
835-
.send(
836-
upstream.socket_addr(),
837-
NetMessage::V1(NetMessageV1::Connect(msg)),
838-
)
835+
.send(upstream, NetMessage::V1(NetMessageV1::Connect(msg)))
839836
.await?;
840837
}
841838
}
@@ -879,10 +876,10 @@ impl Operation for ConnectOp {
879876
};
880877
// Route the response through upstream (where the request came from)
881878
// since we may not have a direct connection to the joiner
882-
if let Some(upstream) = &source_addr {
879+
if let Some(upstream) = source_addr {
883880
network_bridge
884881
.send(
885-
upstream.socket_addr(),
882+
upstream,
886883
NetMessage::V1(NetMessageV1::Connect(response_msg)),
887884
)
888885
.await?;

0 commit comments

Comments
 (0)