Implement S/G IO for non-batched sends and eliminate more data copies (#2867)

This commit is contained in:
Cameron Gutman 2024-07-17 21:34:56 -05:00 committed by GitHub
commit 81c6e61594
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 76 additions and 63 deletions

View file

@ -1535,12 +1535,19 @@ namespace platf {
msg.namelen = sizeof(taddr_v4);
}
WSABUF buf;
buf.buf = (char *) send_info.buffer;
buf.len = send_info.size;
WSABUF bufs[2];
DWORD bufcount = 0;
if (send_info.header) {
bufs[bufcount].buf = (char *) send_info.header;
bufs[bufcount].len = send_info.header_size;
bufcount++;
}
bufs[bufcount].buf = (char *) send_info.payload;
bufs[bufcount].len = send_info.payload_size;
bufcount++;
msg.lpBuffers = &buf;
msg.dwBufferCount = 1;
msg.lpBuffers = bufs;
msg.dwBufferCount = bufcount;
msg.dwFlags = 0;
char cmbuf[std::max(WSA_CMSG_SPACE(sizeof(IN6_PKTINFO)), WSA_CMSG_SPACE(sizeof(IN_PKTINFO)))] = {};