From 4367013d8b56105edd0d27d0b9b6da2becab9717 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 3 Nov 2024 08:38:22 -0800 Subject: Remove untyped stream option functions. The underlying stream APIs have no need for untyped accessors. Another step on the road to removal of NNI_TYPE_OPAQUE. --- tests/tcpsupp.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/tcpsupp.c b/tests/tcpsupp.c index be947129..d7d5c38d 100644 --- a/tests/tcpsupp.c +++ b/tests/tcpsupp.c @@ -97,7 +97,6 @@ TestMain("Supplemental TCP", { char buf1[5]; char buf2[5]; bool on; - size_t sz; So(nng_aio_alloc(&aio1, NULL, NULL) == 0); @@ -110,19 +109,14 @@ TestMain("Supplemental TCP", { }); on = false; - sz = sizeof(on); - So(nng_stream_get(c1, - NNG_OPT_TCP_NODELAY, &on, - &sz) == 0); - So(sz == sizeof(on)); + So(nng_stream_get_bool(c1, + NNG_OPT_TCP_NODELAY, &on) == 0); So(on == true); on = false; - sz = sizeof(on); - So(nng_stream_get(c1, - NNG_OPT_TCP_KEEPALIVE, &on, - &sz) == 0); - So(sz == sizeof(on)); + So(nng_stream_get_bool(c1, + NNG_OPT_TCP_KEEPALIVE, + &on) == 0); // This relies on send completing for // for just 5 bytes, and on recv doing @@ -153,11 +147,9 @@ TestMain("Supplemental TCP", { So(memcmp(buf1, buf2, 5) == 0); Convey("Socket name matches", { - sz = sizeof(sa2); - So(nng_stream_get(c2, - NNG_OPT_LOCADDR, &sa2, - &sz) == 0); - So(sz == sizeof(sa2)); + So(nng_stream_get_addr(c2, + NNG_OPT_LOCADDR, + &sa2) == 0); So(sa2.s_in.sa_family == NNG_AF_INET); @@ -168,11 +160,9 @@ TestMain("Supplemental TCP", { }); Convey("Peer name matches", { - sz = sizeof(sa2); - So(nng_stream_get(c1, - NNG_OPT_REMADDR, &sa2, - &sz) == 0); - So(sz == sizeof(sa2)); + So(nng_stream_get_addr(c1, + NNG_OPT_REMADDR, + &sa2) == 0); So(sa2.s_in.sa_family == NNG_AF_INET); So(sa2.s_in.sa_addr == -- cgit v1.2.3-70-g09d2