two-headBoy commented on code in PR #3595:
URL: https://github.com/apache/brpc/pull/3595#discussion_r4306146150


##########
src/brpc/selective_channel.h:
##########
@@ -72,6 +72,14 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // Add a sub channel, which will be deleted along with schan or explicitly
     // by RemoveAndDestroyChannel.
     // On success, handle is set with the key for removal.
+    //
+    // Ownership (single source of truth: the FIRST successful registration):
+    //   - OWNS_CHANNEL: schan owns sub_channel; caller must not delete it.
+    //   - DOESNT_OWN_CHANNEL: caller owns sub_channel and must delete it.
+    // On failure the same rule applies to the registration being created: 
schan

Review Comment:
   Done — took the first option: AddChannel now consumes an OWNS_CHANNEL 
sub_channel even before Init(), so the failure contract is uniform everywhere. 
Both directions are covered in the new unit test.



-- 
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