chenBright commented on code in PR #3304:
URL: https://github.com/apache/brpc/pull/3304#discussion_r3278311175
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -523,9 +547,27 @@ void* RdmaEndpoint::ProcessHandshakeAtClient(void* arg) {
return NULL;
}
+ // In older versions of brpc, IBV_MTU_1024 is the default mtu type,
+ // So we set remote_mtu IBV_MTU_1024 at default to be ompatible with older
versions.
+ uint16_t remote_mtu_type = IBV_MTU_1024;
if (remote_msg.msg_len > HELLO_MSG_LEN_MIN) {
- // TODO: Read Hello Message customized data
- // Just for future use, should not happen now
+ // Read Hello Message customized data
+ uint16_t remote_msg_ext_len = remote_msg.msg_len - HELLO_MSG_LEN_MIN;
+ uint8_t ext_data[remote_msg_ext_len];
+ if (ep->ReadFromFd(ext_data, remote_msg_ext_len) < 0) {
+ const int saved_errno = errno;
+ PLOG(WARNING) << "Fail to get Hello Message ext fields from
server:" << s->description();
+ s->SetFailed(saved_errno, "Fail to complete rdma handshake from
%s: %s",
+ s->description().c_str(), berror(saved_errno));
+ ep->_state = FAILED;
+ return NULL;
+ }
+ remote_msg.ExtDeserialize(ext_data, remote_msg_ext_len);
+ if (remote_msg_ext_len >= 2) {
+ // mtu_type field is valid
+ remote_mtu_type = remote_msg.mtu_type;
+ }
Review Comment:
By setting the default value of HelloMessage::mtu_type to IBV_MTU_1024, it's
no longer necessary to check remote_msg_ext_len.
--
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]