diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-11-01 22:05:35 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-11-08 17:50:24 -0800 |
| commit | fc6882305f0b5e06e58a0a25740f422d133015b5 (patch) | |
| tree | 714b1fa4656253c8731a8f3f0861c24715440f95 /tests/testutil.c | |
| parent | 4bf06d03f6ebead7f4e0603a2da3b1b891887878 (diff) | |
| download | nng-fc6882305f0b5e06e58a0a25740f422d133015b5.tar.gz nng-fc6882305f0b5e06e58a0a25740f422d133015b5.tar.bz2 nng-fc6882305f0b5e06e58a0a25740f422d133015b5.zip | |
fixes #1041 Abstract socket address for IPC
fixes #1326 Linux IPC could use fchmod
fixes #1327 getsockname on ipc may not work
This introduces an abstract:// style transport, which on Linux
results in using the abstract socket with the given name (not
including the leading NULL byte). A new NNG_AF_ABSTRACT is
provided. Auto bind abstract sockets are also supported.
While here we have inlined the aios for the POSIX ipc pipe
objects, eliminating at least one set of failure paths, and
have also performed various other cleanups.
A unix:// alias is available on POSIX systems, which acts just
like ipc:// (and is fact just an alias). This is supplied so
that in the future we can add support for AF_UNIX on Windows.
We've also absorbed the ipcperms test into the new ipc_test suite.
Finally we are now enforcing that IPC path names on Windows are
not over the maximum size, rather than just silently truncating
them.
Diffstat (limited to 'tests/testutil.c')
| -rw-r--r-- | tests/testutil.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/testutil.c b/tests/testutil.c index 58de1524..7068e394 100644 --- a/tests/testutil.c +++ b/tests/testutil.c @@ -136,7 +136,8 @@ testutil_htonl(uint32_t in) void testutil_scratch_addr(const char *scheme, size_t sz, char *addr) { - if (strcmp(scheme, "inproc") == 0) { + if ((strcmp(scheme, "inproc") == 0) || + (strcmp(scheme, "abstract") == 0)) { (void) snprintf(addr, sz, "%s://testutil%04x%04x%04x%04x", scheme, nng_random(), nng_random(), nng_random(), nng_random()); @@ -158,7 +159,8 @@ testutil_scratch_addr(const char *scheme, size_t sz, char *addr) return; } - if (strncmp(scheme, "ipc", 3) == 0) { + if ((strncmp(scheme, "ipc", 3) == 0) || + (strncmp(scheme, "unix", 4) == 0)) { #ifdef _WIN32 // Windows doesn't place IPC names in the filesystem. (void) snprintf(addr, sz, "%s://testutil%04x%04x%04x%04x", @@ -476,10 +478,10 @@ stream_xfr_alloc(nng_stream *s, void (*submit)(nng_stream *, nng_aio *), nng_aio_begin(x->upper_aio); - x->s = s; - x->rem = size; - x->base = buf; - x->submit = submit; + x->s = s; + x->rem = size; + x->base = buf; + x->submit = submit; return (x); } |
