372046933 commented on code in PR #2267:
URL: https://github.com/apache/brpc/pull/2267#discussion_r1212533566
##########
src/brpc/rdma/rdma_endpoint.cpp:
##########
@@ -801,29 +802,46 @@ ssize_t RdmaEndpoint::CutFromIOBufList(butil::IOBuf**
from, size_t ndata) {
wr.sg_list = sglist;
wr.opcode = IBV_WR_SEND_WITH_IMM;
- RdmaIOBuf* data = (RdmaIOBuf*)from[current];
size_t sge_index = 0;
while (sge_index < (uint32_t)max_sge &&
this_len < _remote_recv_block_size) {
- if (data->size() == 0) {
+ if (from[current]->size() == 0) {
// The current IOBuf is empty, find next one
++current;
if (current == ndata) {
break;
}
- data = (RdmaIOBuf*)from[current];
continue;
}
- ssize_t len = data->cut_into_sglist_and_iobuf(
- sglist, &sge_index, to, max_sge,
- _remote_recv_block_size - this_len);
- if (len < 0) {
- return -1;
+ ssize_t len = 0;
+ if (FLAGS_rdma_send_zerocopy) {
+ ssize_t len =
((RdmaIOBuf*)from[current])->cut_into_sglist_and_iobuf(
+ sglist, &sge_index, to, max_sge,
+ _remote_recv_block_size - this_len);
+ if (len < 0) {
+ return -1;
+ }
+ this_len += len;
+ total_len += len;
+ } else {
+ len = _remote_recv_block_size - this_len;
+ void* buf = AllocBlock(len);
+ if (!buf) {
+ return -1;
+ }
+ len = from[current]->copy_to(buf, len);
+ base::IOBuf tmp;
Review Comment:
use of undeclared identifier 'base'
--
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]