Skip to content

Commit 1fe5585

Browse files
sanityclaude
andcommitted
fix: correct add_subscriber upstream_addr usage per Claude review
- Line 748 (SeekNode): Pass None instead of self.upstream_addr because subscriber address was already corrected by Gateway. Using upstream_addr would overwrite with the forwarder's address. - Line 932 (ReturnSub): Pass None instead of self.upstream_addr because sender was looked up from source_addr and already has correct address. Using upstream_addr would use the original requester's address instead of the provider's. Addresses Claude code review feedback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 361b8be commit 1fe5585

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

crates/core/src/operations/subscribe.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,13 @@ impl Operation for SubscribeOp {
742742
subscribers_before = ?before_direct,
743743
"subscribe: attempting to register direct subscriber"
744744
);
745-
// Use upstream_addr for NAT routing - subscriber may embed wrong address
745+
// Pass None: subscriber address was already corrected by Gateway at the
746+
// start of the subscribe flow. Using self.upstream_addr here would
747+
// incorrectly overwrite with the forwarder's address instead of the
748+
// original subscriber's Gateway-corrected address.
746749
if op_manager
747750
.ring
748-
.add_subscriber(key, subscriber.clone(), self.upstream_addr)
751+
.add_subscriber(key, subscriber.clone(), None)
749752
.is_err()
750753
{
751754
tracing::warn!(
@@ -926,10 +929,13 @@ impl Operation for SubscribeOp {
926929
subscribers_before = ?before_provider,
927930
"subscribe: registering provider/subscription source"
928931
);
929-
// Use upstream_addr for NAT routing - sender may embed wrong address
932+
// Pass None: sender was already looked up from source_addr (line ~866),
933+
// so it has the correct transport address. Using self.upstream_addr
934+
// would incorrectly use the original requester's address instead of
935+
// the provider's address.
930936
if op_manager
931937
.ring
932-
.add_subscriber(key, sender.clone(), self.upstream_addr)
938+
.add_subscriber(key, sender.clone(), None)
933939
.is_err()
934940
{
935941
// concurrently it reached max number of subscribers for this contract

0 commit comments

Comments
 (0)