summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-26 11:14:25 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-26 13:00:21 -0700
commit46ca4756a09d015298b310cd482f2e39d9a034db (patch)
tree2a18c46a1511505edb8386ac75878e984021a8cd /src/core/socket.c
parent9cbdeda1d0a9074bd65da2aaf9c87b79545a1590 (diff)
downloadnng-46ca4756a09d015298b310cd482f2e39d9a034db.tar.gz
nng-46ca4756a09d015298b310cd482f2e39d9a034db.tar.bz2
nng-46ca4756a09d015298b310cd482f2e39d9a034db.zip
fixes #46 make device() use aios directly
This eliminates the separate threads used for devices, letting them benefit from the new aio framework. It also eliminates the legacy nni_sock_sendmsg and nni_sock_recvmsg internal APIs. It would appear that there is an opportunity here to provide asynchronous device support out to userland as well, exposing an aio to them. That work is deferred to later.
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 8fb8e67b..c9b70ccb 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -798,38 +798,6 @@ nni_sock_send(nni_sock *sock, nni_aio *aio)
sock->s_sock_ops.sock_send(sock->s_data, aio);
}
-int
-nni_sock_sendmsg(nni_sock *sock, nni_msg *msg, int flags)
-{
- int rv;
- nni_time expire;
- nni_time timeo = sock->s_sndtimeo;
- nni_aio *aio;
-
- if ((rv = nni_aio_init(&aio, NULL, NULL)) != 0) {
- return (rv);
- }
-
- if ((flags == NNG_FLAG_NONBLOCK) || (timeo == 0)) {
- expire = NNI_TIME_ZERO;
- } else if (timeo == NNI_TIME_NEVER) {
- expire = NNI_TIME_NEVER;
- } else {
- expire = nni_clock();
- expire += timeo;
- }
- nni_aio_set_timeout(aio, expire);
- nni_aio_set_msg(aio, msg);
-
- nni_sock_send(sock, aio);
- nni_aio_wait(aio);
-
- rv = nni_aio_result(aio);
- nni_aio_fini(aio);
-
- return (rv);
-}
-
void
nni_sock_recv(nni_sock *sock, nni_aio *aio)
{
@@ -837,43 +805,6 @@ nni_sock_recv(nni_sock *sock, nni_aio *aio)
sock->s_sock_ops.sock_recv(sock->s_data, aio);
}
-int
-nni_sock_recvmsg(nni_sock *sock, nni_msg **msgp, int flags)
-{
- int rv;
- nni_msg *msg;
- nni_time expire;
- nni_time timeo = sock->s_rcvtimeo;
- nni_aio *aio;
-
- if ((rv = nni_aio_init(&aio, NULL, NULL)) != 0) {
- return (rv);
- }
-
- if ((flags == NNG_FLAG_NONBLOCK) || (timeo == 0)) {
- expire = NNI_TIME_ZERO;
- } else if (timeo == NNI_TIME_NEVER) {
- expire = NNI_TIME_NEVER;
- } else {
- expire = nni_clock();
- expire += timeo;
- }
-
- nni_aio_set_timeout(aio, expire);
- nni_sock_recv(sock, aio);
- nni_aio_wait(aio);
-
- if ((rv = nni_aio_result(aio)) == 0) {
- msg = nni_aio_get_msg(aio);
- nni_aio_set_msg(aio, NULL);
-
- *msgp = msg;
- }
-
- nni_aio_fini(aio);
- return (rv);
-}
-
// nni_sock_protocol returns the socket's 16-bit protocol number.
uint16_t
nni_sock_proto(nni_sock *sock)