mirror of
https://github.com/nanomq/nanomq.git
synced 2025-05-04 03:06:43 +00:00
* FIX [nanomq_cli] fix #1905
Somehow, NNG changes the behaviour of nng_fini Signed-off-by: jaylin <jaylin@emqx.io>
This commit is contained in:
parent
fb436d0400
commit
2ecdb9d31a
@ -409,6 +409,7 @@ struct work {
|
||||
nng_ctx ctx;
|
||||
client_opts *opts;
|
||||
size_t msg_count;
|
||||
nng_socket *sock;
|
||||
};
|
||||
|
||||
#if defined(SUPP_QUIC)
|
||||
@ -1327,7 +1328,8 @@ client_cb(void *arg)
|
||||
work->state = SEND_WAIT;
|
||||
nng_sleep_aio(work->opts->interval, work->aio);
|
||||
} else {
|
||||
nng_fini();
|
||||
nng_socket_close(*work->sock);
|
||||
nng_closeall();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
@ -1529,6 +1531,7 @@ create_client(nng_socket *sock, struct work **works, size_t id, size_t nwork,
|
||||
|
||||
for (size_t i = 0; i < opts->parallel; i++) {
|
||||
works[i] = alloc_work(*sock, opts);
|
||||
works[i]->sock = sock;
|
||||
}
|
||||
|
||||
conn_msg = connect_msg(opts);
|
||||
@ -1645,6 +1648,7 @@ client(int argc, char **argv, enum client_type type)
|
||||
for (size_t j = 0; j < opts->clients; j++) {
|
||||
nng_free(param[j], sizeof(struct connect_param));
|
||||
nng_free(socket[j], sizeof(nng_socket));
|
||||
console("cleaning all clients!\n");
|
||||
|
||||
for (size_t k = 0; k < opts->parallel; k++) {
|
||||
nng_aio_free(works[j][k]->aio);
|
||||
|
Loading…
x
Reference in New Issue
Block a user