guodongxiaren opened a new pull request #1422:
URL: https://github.com/apache/incubator-brpc/pull/1422


   因为 ChannelGroup 有成员函数channel,是通过传入的ProtocolType当成数组_chans下标使用的。
   ```cpp
       brpc::Channel* channel(brpc::ProtocolType type) {
           if ((size_t)type < _chans.size()) {
               return _chans[(size_t)type];
           }
           return NULL;
       }
   ```
   而_chans的大小,是如此定义:
   ```cpp
       for (size_t i = 0; i < protocols.size(); ++i) {
           max_protocol_size = std::max(max_protocol_size,
                                        (size_t)protocols[i].first);
       }
       _chans.resize(max_protocol_size);
   ```
   
   比如当最大的ProtocolType是26的时候,这个数组的大小是26,但是数组的下标只有0到25,那么是无法通过26找到channel的。
   
   当前因为rpc_replay支持回放的协议类型比较少,所以没处问题。


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to