aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2023-12-30 19:35:24 -0800
committerGarrett D'Amore <garrett@damore.org>2023-12-30 19:38:01 -0800
commit838c9eab97c9d954354db711faae8a1fa6c12d38 (patch)
tree8cf3a21772402dfac8cdd4339254ce8b9fcf601b /src/core
parent9b26b72907539910dba42d7396747d18cc020435 (diff)
downloadnng-838c9eab97c9d954354db711faae8a1fa6c12d38.tar.gz
nng-838c9eab97c9d954354db711faae8a1fa6c12d38.tar.bz2
nng-838c9eab97c9d954354db711faae8a1fa6c12d38.zip
fixes #1751 Support nng_aio_set_expire().
While here fixed a number of nits in comments.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/aio_test.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/core/aio_test.c b/src/core/aio_test.c
index bbc997b5..fb0f5c34 100644
--- a/src/core/aio_test.c
+++ b/src/core/aio_test.c
@@ -1,5 +1,5 @@
//
-// Copyright 2022 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2023 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
@@ -191,6 +191,27 @@ test_explicit_timeout(void)
}
void
+test_explicit_expiration(void)
+{
+ nng_socket s;
+ nng_aio * a;
+ int done = 0;
+ nng_time now;
+
+ NUTS_PASS(nng_pair1_open(&s));
+ NUTS_PASS(nng_aio_alloc(&a, cb_done, &done));
+ now = nng_clock();
+ now += 40;
+ nng_aio_set_expire(a, now);
+ nng_recv_aio(s, a);
+ nng_aio_wait(a);
+ NUTS_TRUE(done == 1);
+ NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT);
+ nng_aio_free(a);
+ NUTS_PASS(nng_close(s));
+}
+
+void
test_inherited_timeout(void)
{
nng_socket s;
@@ -384,6 +405,7 @@ NUTS_TESTS = {
{ "consumer cancel", test_consumer_cancel },
{ "traffic", test_traffic },
{ "explicit timeout", test_explicit_timeout },
+ { "explicit expire", test_explicit_expiration },
{ "inherited timeout", test_inherited_timeout },
{ "zero timeout", test_zero_timeout },
{ "aio reap", test_aio_reap },