diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-31 13:26:44 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-31 13:26:44 -0800 |
| commit | b0874b1dad787c32093a3ff81311e2d638dc6538 (patch) | |
| tree | cde1005cef02954893fe2d9786d248930f857200 /src | |
| parent | 2a4a14646f95b21cbc8f9b5bef8d76cd0fe04fec (diff) | |
| download | nng-b0874b1dad787c32093a3ff81311e2d638dc6538.tar.gz nng-b0874b1dad787c32093a3ff81311e2d638dc6538.tar.bz2 nng-b0874b1dad787c32093a3ff81311e2d638dc6538.zip | |
socket: rename nng_close to nng_socket_close
Diffstat (limited to 'src')
25 files changed, 133 insertions, 132 deletions
diff --git a/src/core/aio_test.c b/src/core/aio_test.c index f9663903..d8d70e12 100644 --- a/src/core/aio_test.c +++ b/src/core/aio_test.c @@ -155,7 +155,7 @@ test_consumer_cancel(void) NUTS_TRUE(nng_aio_result(a) == NNG_ECANCELED); nng_aio_free(a); - NUTS_TRUE(nng_close(s1) == 0); + NUTS_CLOSE(s1); } void @@ -207,8 +207,8 @@ test_traffic(void) nng_aio_free(rx_aio); nng_aio_free(tx_aio); - NUTS_PASS(nng_close(s1)); - NUTS_PASS(nng_close(s2)); + NUTS_CLOSE(s1); + NUTS_CLOSE(s2); } void @@ -226,7 +226,7 @@ test_explicit_timeout(void) NUTS_TRUE(done == 1); NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT); nng_aio_free(a); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); } void @@ -247,7 +247,7 @@ test_explicit_expiration(void) NUTS_TRUE(done == 1); NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT); nng_aio_free(a); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); } void @@ -265,7 +265,7 @@ test_inherited_timeout(void) NUTS_TRUE(done == 1); NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT); nng_aio_free(a); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); } void @@ -283,7 +283,7 @@ test_zero_timeout(void) NUTS_TRUE(done == 1); NUTS_FAIL(nng_aio_result(a), NNG_ETIMEDOUT); nng_aio_free(a); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); } static void diff --git a/src/core/buf_size_test.c b/src/core/buf_size_test.c index b33a713b..1290a5c2 100644 --- a/src/core/buf_size_test.c +++ b/src/core/buf_size_test.c @@ -43,7 +43,7 @@ test_buffer_options(void) // Buffer sizes are limited to sane levels NUTS_FAIL(nng_socket_set_int(s1, opt, 0x100000), NNG_EINVAL); } - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } NUTS_TESTS = { diff --git a/src/core/socket.c b/src/core/socket.c index 89352c03..0dfdb183 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -698,7 +698,7 @@ nni_sock_shutdown(nni_sock *sock) // At this point, there are no threads blocked inside of us // that are referencing socket state. User code should call - // nng_close to release the last resources. + // nng_socket_close to release the last resources. return (0); } @@ -26,7 +26,7 @@ #include <string.h> int -nng_close(nng_socket s) +nng_socket_close(nng_socket s) { int rv; nni_sock *sock; diff --git a/src/sp/nonblock_test.c b/src/sp/nonblock_test.c index 0f9be034..7b2251c4 100644 --- a/src/sp/nonblock_test.c +++ b/src/sp/nonblock_test.c @@ -114,10 +114,10 @@ test_nonblocking(void) } nng_msleep(15000); - nng_close(rep); + nng_socket_close(rep); nng_thread_destroy(server); for (int i = 0; i < NCLIENTS; i++) { - nng_close(reqs[i]); + nng_socket_close(reqs[i]); nng_thread_destroy(clients[i]); } } diff --git a/src/sp/pipe_test.c b/src/sp/pipe_test.c index 787eac69..c0219813 100644 --- a/src/sp/pipe_test.c +++ b/src/sp/pipe_test.c @@ -143,8 +143,8 @@ init_cases(char *addr, struct testcase *push, struct testcase *pull) static void fini_cases(struct testcase *push, struct testcase *pull) { - nng_close(push->s); - nng_close(pull->s); + nng_socket_close(push->s); + nng_socket_close(pull->s); nng_cv_free(push->cv); nng_cv_free(pull->cv); nng_mtx_free(push->lk); diff --git a/src/sp/protocol/bus0/bus_test.c b/src/sp/protocol/bus0/bus_test.c index 94ba8329..fd0116e7 100644 --- a/src/sp/protocol/bus0/bus_test.c +++ b/src/sp/protocol/bus0/bus_test.c @@ -378,7 +378,7 @@ test_bus_cooked(void) NUTS_PASS(nng_bus0_open(&s)); NUTS_PASS(nng_socket_raw(s, &b)); NUTS_TRUE(!b); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); // raw pub only differs in the option setting NUTS_PASS(nng_bus0_open_raw(&s)); diff --git a/src/sp/protocol/pair0/pair0_test.c b/src/sp/protocol/pair0/pair0_test.c index d883f1e3..dc3264be 100644 --- a/src/sp/protocol/pair0/pair0_test.c +++ b/src/sp/protocol/pair0/pair0_test.c @@ -215,7 +215,7 @@ test_pair0_send_stopped_aio(void) NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_msg_free(msg); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -235,7 +235,7 @@ test_pair0_send_canceled_aio(void) NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); nng_msg_free(msg); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -251,7 +251,7 @@ test_pair0_recv_stopped_aio(void) nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -267,7 +267,7 @@ test_pair0_recv_canceled_aio(void) nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void test_pair0_raw(void) @@ -278,12 +278,12 @@ test_pair0_raw(void) NUTS_PASS(nng_pair0_open(&s1)); NUTS_PASS(nng_socket_raw(s1, &raw)); NUTS_TRUE(raw == false); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); NUTS_PASS(nng_pair0_open_raw(&s1)); NUTS_PASS(nng_socket_raw(s1, &raw)); NUTS_TRUE(raw == true); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void diff --git a/src/sp/protocol/pair1/pair1_test.c b/src/sp/protocol/pair1/pair1_test.c index 55fbb09f..8ed6ccbf 100644 --- a/src/sp/protocol/pair1/pair1_test.c +++ b/src/sp/protocol/pair1/pair1_test.c @@ -281,7 +281,7 @@ test_pair1_send_stopped_aio(void) NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_msg_free(msg); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -301,7 +301,7 @@ test_pair1_send_canceled_aio(void) NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); nng_msg_free(msg); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -317,7 +317,7 @@ test_pair1_recv_stopped_aio(void) nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ESTOPPED); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -333,7 +333,7 @@ test_pair1_recv_canceled_aio(void) nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECANCELED); nng_aio_free(aio); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void @@ -345,12 +345,12 @@ test_pair1_raw(void) NUTS_PASS(nng_pair1_open(&s1)); NUTS_PASS(nng_socket_raw(s1, &raw)); NUTS_TRUE(raw == false); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); NUTS_PASS(nng_pair1_open_raw(&s1)); NUTS_PASS(nng_socket_raw(s1, &raw)); NUTS_TRUE(raw == true); - NUTS_PASS(nng_close(s1)); + NUTS_CLOSE(s1); } void diff --git a/src/sp/protocol/pipeline0/pull_test.c b/src/sp/protocol/pipeline0/pull_test.c index fb57b9a2..131ff92c 100644 --- a/src/sp/protocol/pipeline0/pull_test.c +++ b/src/sp/protocol/pipeline0/pull_test.c @@ -207,7 +207,7 @@ test_pull_close_recv(void) NUTS_PASS(nng_aio_alloc(&aio, NULL, NULL)); nng_aio_set_timeout(aio, 1000); nng_recv_aio(s, aio); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); diff --git a/src/sp/protocol/pipeline0/push_test.c b/src/sp/protocol/pipeline0/push_test.c index e0d314ee..579178b5 100644 --- a/src/sp/protocol/pipeline0/push_test.c +++ b/src/sp/protocol/pipeline0/push_test.c @@ -271,7 +271,7 @@ test_push_close_send(void) nng_aio_set_timeout(aio, 1000); nng_aio_set_msg(aio, m); nng_send_aio(s, aio); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); diff --git a/src/sp/protocol/pubsub0/pub_test.c b/src/sp/protocol/pubsub0/pub_test.c index 8b3a5d78..2b571bef 100644 --- a/src/sp/protocol/pubsub0/pub_test.c +++ b/src/sp/protocol/pubsub0/pub_test.c @@ -193,7 +193,7 @@ test_pub_cooked(void) NUTS_PASS(nng_pub0_open(&s)); NUTS_PASS(nng_socket_raw(s, &b)); NUTS_TRUE(!b); - NUTS_PASS(nng_close(s)); + NUTS_CLOSE(s); // raw pub only differs in the option setting NUTS_PASS(nng_pub0_open_raw(&s)); diff --git a/src/sp/protocol/reqrep0/req_test.c b/src/sp/protocol/reqrep0/req_test.c index 1dc04a5c..d4dc8c27 100644 --- a/src/sp/protocol/reqrep0/req_test.c +++ b/src/sp/protocol/reqrep0/req_test.c @@ -932,7 +932,7 @@ test_req_ctx_recv_close_socket(void) NUTS_PASS(nng_aio_result(aio)); nng_ctx_recv(ctx, aio); - nng_close(req); + nng_socket_close(req); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); diff --git a/src/sp/protocol/reqrep0/xrep_test.c b/src/sp/protocol/reqrep0/xrep_test.c index 068d64a7..e3ba0f94 100644 --- a/src/sp/protocol/reqrep0/xrep_test.c +++ b/src/sp/protocol/reqrep0/xrep_test.c @@ -142,8 +142,8 @@ test_xrep_validate_peer(void) NUTS_TRUE(nng_stat_type(reject) == NNG_STAT_COUNTER); NUTS_TRUE(nng_stat_value(reject) > 0); - NUTS_PASS(nng_close(s1)); - NUTS_PASS(nng_close(s2)); + NUTS_CLOSE(s1); + NUTS_CLOSE(s2); nng_stats_free(stats); } @@ -353,7 +353,7 @@ test_xrep_ttl_option(void) NUTS_TRUE(nng_socket_set_bool(rep, opt, true) == NNG_EBADTYPE); NUTS_TRUE(nng_socket_get_bool(rep, opt, &b) == NNG_EBADTYPE); - NUTS_TRUE(nng_close(rep) == 0); + NUTS_CLOSE(rep); } static void diff --git a/src/sp/protocol/reqrep0/xreq_test.c b/src/sp/protocol/reqrep0/xreq_test.c index 1f06eb17..b51de556 100644 --- a/src/sp/protocol/reqrep0/xreq_test.c +++ b/src/sp/protocol/reqrep0/xreq_test.c @@ -358,7 +358,7 @@ test_xreq_ttl_option(void) NUTS_TRUE(nng_socket_set_bool(rep, opt, true) == NNG_EBADTYPE); NUTS_TRUE(nng_socket_get_bool(rep, opt, &b) == NNG_EBADTYPE); - NUTS_TRUE(nng_close(rep) == 0); + NUTS_CLOSE(rep); } NUTS_TESTS = { diff --git a/src/sp/protocol/survey0/survey_test.c b/src/sp/protocol/survey0/survey_test.c index 3f122abb..0489bf9f 100644 --- a/src/sp/protocol/survey0/survey_test.c +++ b/src/sp/protocol/survey0/survey_test.c @@ -502,7 +502,7 @@ test_surv_ctx_recv_close_socket(void) NUTS_PASS(nng_aio_result(aio)); nng_ctx_recv(ctx, aio); - nng_close(surv); + nng_socket_close(surv); nng_aio_wait(aio); NUTS_FAIL(nng_aio_result(aio), NNG_ECLOSED); @@ -594,8 +594,8 @@ test_surv_validate_peer(void) NUTS_TRUE(nng_stat_type(reject) == NNG_STAT_COUNTER); NUTS_TRUE(nng_stat_value(reject) > 0); - NUTS_PASS(nng_close(s1)); - NUTS_PASS(nng_close(s2)); + NUTS_CLOSE(s1); + NUTS_CLOSE(s2); nng_stats_free(stats); } diff --git a/src/sp/reconnect_stress_test.c b/src/sp/reconnect_stress_test.c index f463e0e5..578e34bd 100644 --- a/src/sp/reconnect_stress_test.c +++ b/src/sp/reconnect_stress_test.c @@ -8,12 +8,12 @@ // #include <assert.h> -#include <nng/nng.h> #include <core/nng_impl.h> -#include <nng/protocol/survey0/survey.h> -#include <nng/protocol/survey0/respond.h> -#include <nng/protocol/reqrep0/req.h> +#include <nng/nng.h> #include <nng/protocol/reqrep0/rep.h> +#include <nng/protocol/reqrep0/req.h> +#include <nng/protocol/survey0/respond.h> +#include <nng/protocol/survey0/survey.h> #include <nuts.h> @@ -26,10 +26,10 @@ struct work; typedef void (*work_fn)(struct work *); struct work { - work_fn start; - nng_socket socket; - nng_aio * aio; - enum state state; + work_fn start; + nng_socket socket; + nng_aio *aio; + enum state state; nni_atomic_int received; }; @@ -40,10 +40,10 @@ fatal(const char *msg, int result) abort(); } -#define PASS(cond) \ - do { \ - int result_ = (cond); \ - if (result_ != 0) \ +#define PASS(cond) \ + do { \ + int result_ = (cond); \ + if (result_ != 0) \ fatal(#cond, result_); \ } while (0) @@ -76,7 +76,7 @@ work_listen(struct work *w, const char *url) } void -work_dial(struct work *w, const char * const * urls, size_t urls_size) +work_dial(struct work *w, const char *const *urls, size_t urls_size) { size_t i; @@ -87,7 +87,7 @@ work_dial(struct work *w, const char * const * urls, size_t urls_size) void close_work(struct work *w) { - nng_close(w->socket); + nng_socket_close(w->socket); nng_aio_wait(w->aio); nng_aio_free(w->aio); } @@ -101,39 +101,39 @@ ping_start(struct work *w) void ping_cb(void *arg) { - nng_msg *msg; - struct work *w = arg; - int result = nng_aio_result(w->aio); + nng_msg *msg; + struct work *w = arg; + int result = nng_aio_result(w->aio); if (result) switch (result) { - case NNG_ETIMEDOUT: - case NNG_ESTATE: - free_aio_msg(w); - ping_start(w); - return; - case NNG_ECANCELED: - case NNG_ECLOSED: - free_aio_msg(w); - return; - default: - fatal("ping_cb", result); + case NNG_ETIMEDOUT: + case NNG_ESTATE: + free_aio_msg(w); + ping_start(w); + return; + case NNG_ECANCELED: + case NNG_ECLOSED: + free_aio_msg(w); + return; + default: + fatal("ping_cb", result); } switch (w->state) { - case SEND: - w->state = RECV; - nng_recv_aio(w->socket, w->aio); - break; - case RECV: - msg = nng_aio_get_msg(w->aio); - assert(msg != NULL); - assert(nng_msg_len(msg) == 5); - assert(0 == strncmp(nng_msg_body(msg), "echo", 4)); - nng_msg_free(msg); - nni_atomic_inc(&w->received); - ping_start(w); - break; + case SEND: + w->state = RECV; + nng_recv_aio(w->socket, w->aio); + break; + case RECV: + msg = nng_aio_get_msg(w->aio); + assert(msg != NULL); + assert(nng_msg_len(msg) == 5); + assert(0 == strncmp(nng_msg_body(msg), "echo", 4)); + nng_msg_free(msg); + nni_atomic_inc(&w->received); + ping_start(w); + break; } } @@ -147,48 +147,49 @@ echo_start(struct work *w) void echo_cb(void *arg) { - nng_msg *msg; - struct work *w = arg; - int result = nng_aio_result(w->aio); + nng_msg *msg; + struct work *w = arg; + int result = nng_aio_result(w->aio); if (result) switch (result) { - case NNG_ECANCELED: - case NNG_ECLOSED: - free_aio_msg(w); - return; - default: - fatal("echo_cb", result); + case NNG_ECANCELED: + case NNG_ECLOSED: + free_aio_msg(w); + return; + default: + fatal("echo_cb", result); } switch (w->state) { - case RECV: - msg = nng_aio_get_msg(w->aio); - assert(msg != NULL); - assert(nng_msg_len(msg) == 5); - assert(0 == strncmp(nng_msg_body(msg), "ping", 4)); - nng_msg_free(msg); - nni_atomic_inc(&w->received); - work_send(w, "echo", 5); - break; - case SEND: - echo_start(w); - break; + case RECV: + msg = nng_aio_get_msg(w->aio); + assert(msg != NULL); + assert(nng_msg_len(msg) == 5); + assert(0 == strncmp(nng_msg_body(msg), "ping", 4)); + nng_msg_free(msg); + nni_atomic_inc(&w->received); + work_send(w, "echo", 5); + break; + case SEND: + echo_start(w); + break; } } -#define CLIENTS_COUNT 64 -#define SERVICES_COUNT 8 -#define CLIENT_RX_COUNT 100 -#define TEST_DURATION_MS 3000 -#define SURVEY_TIMEOUT_MS 100 +#define CLIENTS_COUNT 64 +#define SERVICES_COUNT 8 +#define CLIENT_RX_COUNT 100 +#define TEST_DURATION_MS 3000 +#define SURVEY_TIMEOUT_MS 100 void surveyor_open(struct work *w) { w->start = ping_start; NUTS_PASS(nng_surveyor_open(&w->socket)); - NUTS_PASS(nng_socket_set_ms(w->socket, NNG_OPT_SURVEYOR_SURVEYTIME, SURVEY_TIMEOUT_MS)); + NUTS_PASS(nng_socket_set_ms( + w->socket, NNG_OPT_SURVEYOR_SURVEYTIME, SURVEY_TIMEOUT_MS)); NUTS_PASS(nng_aio_alloc(&w->aio, ping_cb, w)); nni_atomic_init(&w->received); } @@ -223,14 +224,14 @@ rep_open(struct work *w) void run_test(work_fn open_service, work_fn open_client) { - int i; - nng_time stop_time; - struct work * service; - struct work * client; - struct work services[SERVICES_COUNT]; - struct work clients [CLIENTS_COUNT]; - - const char * service_urls[SERVICES_COUNT] = { + int i; + nng_time stop_time; + struct work *service; + struct work *client; + struct work services[SERVICES_COUNT]; + struct work clients[CLIENTS_COUNT]; + + const char *service_urls[SERVICES_COUNT] = { "inproc://stressA", "inproc://stressB", "inproc://stressC", diff --git a/src/sp/scalability_test.c b/src/sp/scalability_test.c index 6e9047a1..7579fe7f 100644 --- a/src/sp/scalability_test.c +++ b/src/sp/scalability_test.c @@ -38,7 +38,7 @@ serve(void *arg) if (msg != NULL) { nng_msg_free(msg); } - nng_close(rep); + nng_socket_close(rep); } int diff --git a/src/sp/transport/tcp/tcp_test.c b/src/sp/transport/tcp/tcp_test.c index c8e54a2d..a7ff5e96 100644 --- a/src/sp/transport/tcp/tcp_test.c +++ b/src/sp/transport/tcp/tcp_test.c @@ -198,7 +198,7 @@ test_tcp_recv_max(void) NUTS_TRUE(sz == 95); NUTS_PASS(nng_send(s1, msg, 150, 0)); NUTS_FAIL(nng_recv(s0, buf, &sz, 0), NNG_ETIMEDOUT); - NUTS_PASS(nng_close(s0)); + NUTS_CLOSE(s0); NUTS_CLOSE(s1); } diff --git a/src/sp/transport/tls/tls_tran_test.c b/src/sp/transport/tls/tls_tran_test.c index 6e1835a6..4e3ea00b 100644 --- a/src/sp/transport/tls/tls_tran_test.c +++ b/src/sp/transport/tls/tls_tran_test.c @@ -327,7 +327,7 @@ test_tls_recv_max(void) NUTS_TRUE(sz == 95); NUTS_PASS(nng_send(s1, msg, 150, 0)); NUTS_FAIL(nng_recv(s0, buf, &sz, 0), NNG_ETIMEDOUT); - NUTS_PASS(nng_close(s0)); + NUTS_CLOSE(s0); NUTS_CLOSE(s1); nng_tls_config_free(c0); nng_tls_config_free(c1); @@ -369,7 +369,7 @@ test_tls_psk(void) NUTS_PASS(nng_send(s1, msg, 95, 0)); NUTS_PASS(nng_recv(s0, buf, &sz, 0)); NUTS_TRUE(sz == 95); - NUTS_PASS(nng_close(s0)); + NUTS_CLOSE(s0); NUTS_CLOSE(s1); nng_tls_config_free(c0); nng_tls_config_free(c1); diff --git a/src/sp/transport/udp/udp_tran_test.c b/src/sp/transport/udp/udp_tran_test.c index 014c36dc..b1c3b60a 100644 --- a/src/sp/transport/udp/udp_tran_test.c +++ b/src/sp/transport/udp/udp_tran_test.c @@ -152,7 +152,7 @@ test_udp_recv_max(void) NUTS_TRUE(sz == 95); NUTS_PASS(nng_send(s1, msg, 150, 0)); NUTS_FAIL(nng_recv(s0, buf, &sz, 0), NNG_ETIMEDOUT); - NUTS_PASS(nng_close(s0)); + NUTS_CLOSE(s0); NUTS_CLOSE(s1); } diff --git a/src/supplemental/websocket/wssfile_test.c b/src/supplemental/websocket/wssfile_test.c index ac8ad4b9..7239a1c7 100644 --- a/src/supplemental/websocket/wssfile_test.c +++ b/src/supplemental/websocket/wssfile_test.c @@ -101,8 +101,8 @@ test_invalid_verify(void) NUTS_TRUE((rv == NNG_EPEERAUTH) || (rv == NNG_ECLOSED) || (rv == NNG_ECRYPTO)); - NUTS_PASS(nng_close(s1)); - NUTS_PASS(nng_close(s2)); + NUTS_CLOSE(s1); + NUTS_CLOSE(s2); } static void @@ -202,8 +202,8 @@ test_verify_works(void) NUTS_TRUE(b == true); nng_msg_free(msg); - NUTS_PASS(nng_close(s1)); - NUTS_PASS(nng_close(s2)); + NUTS_CLOSE(s1); + NUTS_CLOSE(s2); } static void @@ -271,8 +271,8 @@ test_tls_config(void) NUTS_TRUE((rv == NNG_EPEERAUTH) || (rv == NNG_ECLOSED) || (rv == NNG_ECRYPTO)); - NUTS_PASS(nng_close(s1)); - NUTS_PASS(nng_close(s2)); + NUTS_CLOSE(s1); + NUTS_CLOSE(s2); } #endif diff --git a/src/testing/nuts.h b/src/testing/nuts.h index 421e0a53..b0c30245 100644 --- a/src/testing/nuts.h +++ b/src/testing/nuts.h @@ -23,7 +23,7 @@ extern void nuts_logger( nng_log_level, nng_log_facility, const char *, const char *); // Call nng_fini during test finalization -- this avoids leak warnings. -// We add a 20 millisecond delay as a hack to allow for other subsytems to +/// We add a 20 millisecond delay as a hack to allow for other subsytems to // drain first. (Notably the HTTP framework can fail if we shut down too // quickly. These bugs should be fixed and then the sleep can be removed.) #ifndef TEST_FINI @@ -285,7 +285,7 @@ extern const char *nuts_ecdsa_client_crt; #define NUTS_OPEN(sock) NUTS_PASS(nng_pair1_open(&(sock))) -#define NUTS_CLOSE(sock) NUTS_PASS(nng_close(sock)) +#define NUTS_CLOSE(sock) NUTS_PASS(nng_socket_close(sock)) #define NUTS_SLEEP(ms) nuts_sleep(ms) diff --git a/src/tools/perf/perf.c b/src/tools/perf/perf.c index c7057c73..1b985c1c 100644 --- a/src/tools/perf/perf.c +++ b/src/tools/perf/perf.c @@ -499,7 +499,7 @@ latency_client(const char *addr, size_t msgsize, int trips) end = nng_clock(); nng_msg_free(msg); - nng_close(s); + nng_socket_close(s); total = (float) ((end - start)) / 1000; latency = ((float) ((total * 1000000)) / (float) (trips * 2)); @@ -544,7 +544,7 @@ latency_server(const char *addr, size_t msgsize, int trips) // Wait a bit for things to drain... linger should do this. // 100ms ought to be enough. nng_msleep(100); - nng_close(s); + nng_socket_close(s); } // Our throughput story is quite a mess. Mostly I think because of the poor @@ -598,7 +598,7 @@ throughput_server(const char *addr, size_t msgsize, int count) // and wait a bit to make sure it goes out the wire. nng_send(s, "", 0, 0); nng_msleep(200); - nng_close(s); + nng_socket_close(s); total = (float) ((end - start)) / 1000; msgpersec = (float) (count) / total; mbps = (float) (msgpersec * 8 * msgsize) / (1024 * 1024); @@ -664,5 +664,5 @@ throughput_client(const char *addr, size_t msgsize, int count) nng_msg_free(msg); } - nng_close(s); + nng_socket_close(s); } diff --git a/src/tools/perf/pubdrop.c b/src/tools/perf/pubdrop.c index 020bae0f..6f0e5553 100644 --- a/src/tools/perf/pubdrop.c +++ b/src/tools/perf/pubdrop.c @@ -179,7 +179,7 @@ pub_server(void *arg) end = nng_clock(); nng_msleep(1000); // drain the queue - nng_close(sock); + nng_socket_close(sock); nng_mtx_lock(pa->mtx); pa->beg = start; |
