Copilot commented on code in PR #3359:
URL: https://github.com/apache/brpc/pull/3359#discussion_r3485803407


##########
src/brpc/selective_channel.cpp:
##########
@@ -571,7 +581,8 @@ void SelectiveChannel::CallMethod(
         cntl->SetFailed(EINVAL, "SelectiveChannel=%p is not initialized yet",
                         this);
     }
-    schan::Sender* sndr = new schan::Sender(cntl, request, response, 
user_done);
+    schan::Sender* sndr =

Review Comment:
   When the SelectiveChannel is not initialized, CallMethod sets the controller 
failure but continues to allocate a Sender and dispatch into 
`_chan.CallMethod(...)`. This can override the intended error handling and may 
pass a null balancer into `Sender`, leading to different (or confusing) error 
results and unnecessary work. PartitionChannel and other channels return early 
and (if provided) run `done` in-place on misuse; SelectiveChannel should do the 
same here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to