From e8694d15d0a108895bf869f292d59e11d834361e Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 13 Nov 2017 21:10:03 -0800 Subject: fixes #154 underlyng TCP & IPC transports should support partial recv/send fixes #155 POSIX TCP & IPC could avoid a lot of context switches --- src/core/defs.h | 4 ++-- src/core/platform.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/defs.h b/src/core/defs.h index 57f7f06a..5a9ded92 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -62,8 +62,8 @@ typedef void (*nni_cb)(void *); // Used by transports for scatter gather I/O. typedef struct { - void * iov_buf; - size_t iov_len; + uint8_t *iov_buf; + size_t iov_len; } nni_iov; // Notify descriptor. diff --git a/src/core/platform.h b/src/core/platform.h index bff7f709..9e193175 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -229,8 +229,17 @@ extern void nni_plat_tcp_pipe_close(nni_plat_tcp_pipe *); // The platform may modify the iovs. extern void nni_plat_tcp_pipe_send(nni_plat_tcp_pipe *, nni_aio *); -// nni_plat_tcp_pipe_recv recvs data into the buffers provided by the iovs. -// The platform may modify the iovs. +// nni_plat_tcp_pipe_recv receives data into the buffers provided by the +// I/O vector (iovs). The platform should attempt to scatter the received +// data into the iovs if possible. +// +// It is an error for the caller to supply any IO vector elements with +// zero length. +// +// It is possible for the TCP reader to return less data than is requested, +// in which case the caller is responsible for resubmitting. The platform +// should not return "zero" data however. (It is an error to attempt to +// receive zero bytes.) The platform may not modify the I/O vector. extern void nni_plat_tcp_pipe_recv(nni_plat_tcp_pipe *, nni_aio *); // nni_plat_tcp_pipe_peername gets the peer name. -- cgit v1.2.3-70-g09d2