std.Io: vectored sendmsg/recvmsg #25938
Open
+70
−71
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for vectored
sendmsg/recvmsg(netSend/netReceive) instd.Ioand theThreadedandKqueueimplementations.The only users of these functions are
std.Io.net.Socket, which I adapted to keep its existing API, andstd.Io.Threaded.lookupDnsnetReceivewas somewhat special-cased for lookupDns I think. Instead of each message having a its own data buffer(or buffers for vectored io), it would use a common buffer and partition it for each message. This fits thelookupDnsuse-case, but is seriously limiting for a general purpose interface. It makes implementing things such as ring buffers impossible.The changes boil down to:
IncomingMessage.datais now caller supplied instead of populated by the Io implementation. It can be a single buffer or multiple for vectored operationsbytes_sent/bytes_receivedinstead of reusing the slice lengthOutgoingMessage.addressnullable to allow for usage with connected sockets (TCP, Unix) which do not need an address