aboutsummaryrefslogtreecommitdiff
path: root/src/core/aio.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-01-21 22:40:10 -0800
committerGarrett D'Amore <garrett@damore.org>2019-02-16 19:22:27 -0800
commit5cf750697624d4fd63cfe26921209d7c30e1a2d2 (patch)
treebf11695e5f1ec5e400c87da0cc6ff23935a2eeff /src/core/aio.c
parentca655b9db689ee0e655248b1a9f166b8db6cc984 (diff)
downloadnng-5cf750697624d4fd63cfe26921209d7c30e1a2d2.tar.gz
nng-5cf750697624d4fd63cfe26921209d7c30e1a2d2.tar.bz2
nng-5cf750697624d4fd63cfe26921209d7c30e1a2d2.zip
fixes #872 create unified nng_stream API
This is a major change, and includes changes to use a polymorphic stream API for all transports. There have been related bugs fixed along the way. Additionally the man pages have changed. The old non-polymorphic APIs are removed now. This is a breaking change, but the old APIs were never part of any released public API.
Diffstat (limited to 'src/core/aio.c')
-rw-r--r--src/core/aio.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/aio.c b/src/core/aio.c
index b67b7467..ee3d10a5 100644
--- a/src/core/aio.c
+++ b/src/core/aio.c
@@ -1,5 +1,5 @@
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -101,6 +101,12 @@ struct nng_aio {
nni_list_node a_prov_node;
void * a_prov_extra[4]; // Extra data used by provider
+ // Socket address. This turns out to be very useful, as we wind up
+ // needing socket addresses for numerous connection related routines.
+ // It would be cleaner to not have this and avoid burning the space,
+ // but having this hear dramatically simplifies lots of code.
+ nng_sockaddr a_sockaddr;
+
// Expire node.
nni_list_node a_expire_node;
};
@@ -765,3 +771,15 @@ nni_aio_sys_init(void)
nni_thr_run(thr);
return (0);
}
+
+void
+nni_aio_set_sockaddr(nni_aio *aio, const nng_sockaddr *sa)
+{
+ memcpy(&aio->a_sockaddr, sa, sizeof(*sa));
+}
+
+void
+nni_aio_get_sockaddr(nni_aio *aio, nng_sockaddr *sa)
+{
+ memcpy(sa, &aio->a_sockaddr, sizeof(*sa));
+} \ No newline at end of file