aboutsummaryrefslogtreecommitdiff
path: root/src/sp/transport/ipc
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-05 22:25:24 -0800
committerGarrett D'Amore <garrett@damore.org>2024-11-05 22:25:24 -0800
commit85927b8d0d0a751e4c65849c392ef9d0e42a1bd7 (patch)
treef2b97814bc6a72381766b655435917f664257298 /src/sp/transport/ipc
parentb82e942b5915bb3b957e02b2ed1ff6de10e413af (diff)
downloadnng-85927b8d0d0a751e4c65849c392ef9d0e42a1bd7.tar.gz
nng-85927b8d0d0a751e4c65849c392ef9d0e42a1bd7.tar.bz2
nng-85927b8d0d0a751e4c65849c392ef9d0e42a1bd7.zip
ipc: listener cancellation test
Diffstat (limited to 'src/sp/transport/ipc')
-rw-r--r--src/sp/transport/ipc/ipc_test.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sp/transport/ipc/ipc_test.c b/src/sp/transport/ipc/ipc_test.c
index f3ce8d41..083326bb 100644
--- a/src/sp/transport/ipc/ipc_test.c
+++ b/src/sp/transport/ipc/ipc_test.c
@@ -230,6 +230,27 @@ test_ipc_connect_blocking_accept(void)
}
void
+test_ipc_listen_accept_cancel(void)
+{
+ nng_stream_listener *l;
+ char *addr;
+ nng_aio *aio;
+
+ NUTS_ENABLE_LOG(NNG_LOG_INFO);
+ NUTS_ADDR(addr, "ipc");
+ NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL));
+
+ // start a listening stream listener but do not call accept
+ NUTS_PASS(nng_stream_listener_alloc(&l, addr));
+ NUTS_PASS(nng_stream_listener_listen(l));
+ nng_stream_listener_accept(l, aio);
+ nng_msleep(100);
+ nng_aio_free(aio);
+ nng_stream_listener_close(l);
+ nng_stream_listener_free(l);
+}
+
+void
test_ipc_listener_clean_stale(void)
{
#ifdef NNG_PLATFORM_POSIX
@@ -539,6 +560,7 @@ TEST_LIST = {
{ "ipc connect blocking", test_ipc_connect_blocking },
{ "ipc connect blocking accept", test_ipc_connect_blocking_accept },
{ "ipc listen cleanup stale", test_ipc_listener_clean_stale },
+ { "ipc listen accept cancel", test_ipc_listen_accept_cancel },
{ "ipc abstract sockets", test_abstract_sockets },
{ "ipc abstract auto bind", test_abstract_auto_bind },
{ "ipc abstract name too long", test_abstract_too_long },