diff options
author | Mark Stapp <mjs@voltanet.io> | 2021-04-06 20:41:45 +0200 |
---|---|---|
committer | Mark Stapp <mjs@voltanet.io> | 2021-04-06 20:41:45 +0200 |
commit | e08165def1c62beee0e87385e37ea5f12ca0f9b9 (patch) | |
tree | e62ca326b24f9609c6b99089f088f799f461adaf /lib | |
parent | lib: use public task-scheduling apis (diff) | |
download | frr-e08165def1c62beee0e87385e37ea5f12ca0f9b9.tar.xz frr-e08165def1c62beee0e87385e37ea5f12ca0f9b9.zip |
lib: logic and macro cleanup in frr_zmq shim
Fix a couple of logic/macro issues in the frr_zmq shim
module.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/frr_zmq.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/frr_zmq.c b/lib/frr_zmq.c index f87200d64..ce52848a2 100644 --- a/lib/frr_zmq.c +++ b/lib/frr_zmq.c @@ -310,7 +310,7 @@ void frrzmq_thread_cancel(struct frrzmq_cb **cb, struct cb_core *core) thread_cancel(&core->thread); if ((*cb)->read.cancelled && !(*cb)->read.thread - && (*cb)->write.cancelled && (*cb)->write.thread) + && (*cb)->write.cancelled && !(*cb)->write.thread) XFREE(MTYPE_ZEROMQ_CB, *cb); } @@ -330,12 +330,16 @@ void frrzmq_check_events(struct frrzmq_cb **cbp, struct cb_core *core, len = sizeof(events); if (zmq_getsockopt(cb->zmqsock, ZMQ_EVENTS, &events, &len)) return; - if (events & event && core->thread && !core->cancelled) { + if ((events & event) && core->thread && !core->cancelled) { struct thread_master *tm = core->thread->master; + thread_cancel(&core->thread); - thread_add_event(tm, (event == ZMQ_POLLIN ? frrzmq_read_msg - : frrzmq_write_msg), - cbp, cb->fd, &core->thread); + if (event == ZMQ_POLLIN) + thread_add_event(tm, frrzmq_read_msg, + cbp, cb->fd, &core->thread); + else + thread_add_event(tm, frrzmq_write_msg, + cbp, cb->fd, &core->thread); } } |