wasphin commented on code in PR #1806:
URL: https://github.com/apache/incubator-brpc/pull/1806#discussion_r901112196


##########
src/brpc/socket_map.h:
##########
@@ -47,17 +47,18 @@ inline bool operator!=(const ChannelSignature& s1, const 
ChannelSignature& s2) {
 // The following fields uniquely define a Socket. In other word,
 // Socket can't be shared between 2 different SocketMapKeys
 struct SocketMapKey {
-    explicit SocketMapKey(const butil::EndPoint& pt)
-        : peer(pt)
+    explicit SocketMapKey(const butil::EndPoint& pt, const std::string& 
hc_path)
+        : peer(pt), health_check_path(hc_path)
     {}
-    SocketMapKey(const butil::EndPoint& pt, const ChannelSignature& cs)
-        : peer(pt), channel_signature(cs)
+    SocketMapKey(const butil::EndPoint& pt, const std::string& hc_path, const 
ChannelSignature& cs)
+        : peer(pt), health_check_path(hc_path), channel_signature(cs)
     {}
-    SocketMapKey(const ServerNode& sn, const ChannelSignature& cs)
-        : peer(sn), channel_signature(cs)
+    SocketMapKey(const ServerNode& sn, const std::string& hc_path, const 
ChannelSignature& cs)
+        : peer(sn), health_check_path(hc_path), channel_signature(cs)
     {}
 
     ServerNode peer;
+    std::string health_check_path;

Review Comment:
   我想歪了, 这样似乎之前的处理更合适些, 不过还是觉得有些别扭, 看其他人有没有什么建议吧.
   
   如果存到 key 里, 还需要更新下 `operator==` 以及 `SocketMapKeyHasher`
   
   另外 `hc_path` 作为 channel 的一部分, 也需要在 `ComputeChannelSignature` 时计算下, 
这样同一个地址不同的 hc_path 不能用一个 socket.



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