wwbmmm commented on code in PR #1836:
URL: https://github.com/apache/incubator-brpc/pull/1836#discussion_r935263314
##########
src/brpc/channel.cpp:
##########
@@ -149,6 +169,16 @@ int Channel::InitChannelOptions(const ChannelOptions*
options) {
LOG(ERROR) << "Channel does not support the protocol";
return -1;
}
+
+#if BRPC_WITH_RDMA
Review Comment:
没有BRPC_WITH_RDMA宏的时候,如果用户设置options里的use_rdma,是不是应该报错
##########
CMakeLists.txt:
##########
@@ -68,6 +69,12 @@ if(WITH_THRIFT)
set(THRIFT_LIB "thrift")
endif()
+set(WITH_RDMA_VAL "0")
+if(WITH_RDMA)
+ set(WITH_RDMA_VAL "1")
+ set(BRPC_WITH_RDMA 1)
Review Comment:
这个有用到吗
##########
src/brpc/socket.cpp:
##########
@@ -626,6 +630,23 @@ int Socket::Create(const SocketOptions& options, SocketId*
id) {
m->_ssl_state = (options.initial_ssl_ctx == NULL ? SSL_OFF : SSL_UNKNOWN);
m->_ssl_session = NULL;
m->_ssl_ctx = options.initial_ssl_ctx;
+#if BRPC_WITH_RDMA
+ if (options.use_rdma) {
+ m->_rdma_ep = new (std::nothrow)rdma::RdmaEndpoint(m);
+ if (!m->_rdma_ep) {
+ const int saved_errno = errno;
+ PLOG(ERROR) << "Fail to create RdmaEndpoint";
+ m->SetFailed(saved_errno, "Fail to create RdmaEndpoint: %s",
+ berror(saved_errno));
+ return -1;
+ }
+ m->_rdma_state = RDMA_UNKNOWN;
+ } else {
+ delete m->_rdma_ep;
Review Comment:
同厂内评论,确保这里一定是NULL
##########
src/brpc/input_messenger.cpp:
##########
@@ -85,6 +86,15 @@ ParseResult InputMessenger::CutInputMessage(
<< " bytes, the connection will be closed."
" Set max_body_size to allow bigger messages";
return result;
+ } else {
+ if (m->_read_buf.size() >= 4) {
+ char data[4];
Review Comment:
缩进有问题
##########
src/brpc/input_messenger.cpp:
##########
@@ -85,6 +86,15 @@ ParseResult InputMessenger::CutInputMessage(
<< " bytes, the connection will be closed."
" Set max_body_size to allow bigger messages";
return result;
+ } else {
+ if (m->_read_buf.size() >= 4) {
+ char data[4];
+ m->_read_buf.copy_to_cstr(data, 4);
+ if (strncmp(data, "RDMA", 4) == 0 && m->_rdma_state ==
Socket::RDMA_OFF) {
Review Comment:
这个 4 能否定义成常量
--
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]