diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-02 23:16:22 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-02 23:16:22 -0700 |
| commit | 8bac5ccdf1de7334311459b9e2666e74a2c16c15 (patch) | |
| tree | 169ce8229a1a0eb6e810685a9923be1c2bf644a6 /src/sp/protocol/reqrep0/rep_test.c | |
| parent | d3622c0f6153ce0eccaad9c986d46b07cec91b5d (diff) | |
| download | nng-8bac5ccdf1de7334311459b9e2666e74a2c16c15.tar.gz nng-8bac5ccdf1de7334311459b9e2666e74a2c16c15.tar.bz2 nng-8bac5ccdf1de7334311459b9e2666e74a2c16c15.zip | |
Replace `NNG_OPT_PROTO`, `NNG_OPT_PROTONAME`, and friends with functions.
Socket options were a little awkward, and these are core properties
of the socket. Few if any applications need these. This also avoids
some dynamic allocations.
Diffstat (limited to 'src/sp/protocol/reqrep0/rep_test.c')
| -rw-r--r-- | src/sp/protocol/reqrep0/rep_test.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/sp/protocol/reqrep0/rep_test.c b/src/sp/protocol/reqrep0/rep_test.c index 58a54afe..6ca8fbca 100644 --- a/src/sp/protocol/reqrep0/rep_test.c +++ b/src/sp/protocol/reqrep0/rep_test.c @@ -13,23 +13,21 @@ static void test_rep_identity(void) { - nng_socket s; - int p1, p2; - char *n1; - char *n2; + nng_socket s; + uint16_t p1, p2; + const char *n1; + const char *n2; NUTS_PASS(nng_rep0_open(&s)); - NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PROTO, &p1)); - NUTS_PASS(nng_socket_get_int(s, NNG_OPT_PEER, &p2)); - NUTS_PASS(nng_socket_get_string(s, NNG_OPT_PROTONAME, &n1)); - NUTS_PASS(nng_socket_get_string(s, NNG_OPT_PEERNAME, &n2)); + NUTS_PASS(nng_socket_proto_id(s, &p1)); + NUTS_PASS(nng_socket_peer_id(s, &p2)); + NUTS_PASS(nng_socket_proto_name(s, &n1)); + NUTS_PASS(nng_socket_peer_name(s, &n2)); NUTS_CLOSE(s); NUTS_TRUE(p1 == NNG_REP0_SELF); NUTS_TRUE(p2 == NNG_REP0_PEER); NUTS_MATCH(n1, NNG_REP0_SELF_NAME); NUTS_MATCH(n2, NNG_REP0_PEER_NAME); - nng_strfree(n1); - nng_strfree(n2); } void |
