-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Blocking SIGINT Fix to JSON and Presentation Inputs #170
base: next
Are you sure you want to change the base?
Conversation
nmsg/input_json.c
Outdated
@@ -57,6 +57,15 @@ _input_json_read(nmsg_input_t input, nmsg_message_t *msg) { | |||
struct nmsg_strbuf_storage sbs; | |||
struct nmsg_strbuf *sb = _nmsg_strbuf_init(&sbs); | |||
|
|||
/* make sure our input is valid and that we have nothing to read */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that given that we will now have this exact code stanza in exactly 3 different places, it might be time to make a common function like nmsg_res input_can_read(int fd)
... maybe in nmsg/input.c
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea; done.
e9294bb
to
fd58770
Compare
In MR #156, a bugfix was added to prevent NMSG inputs from blocking on SIGINT; this fix did not extend to JSON and Presentation inputs. That has been fixed here, and the same reviewers of that MR have also been added here.
I have also verified that this bug does not occur with PCAP, ZMQ, and socket inputs.
Note: The original unit test
test-io/test_dummy()
would fail if the value returned fromnmsg_input_read()
(and by extension_input_read_json()
) was notnmsg_res_success
ornmsg_res_eof
. The ideal solution to this, as discussed by Stephen and I, is to adjust the unit test to callnmsg_input_read()
again whennmsg_res_again
is returned. The intention is that this is a backwards-compatible change that conveys more information to the caller ofnmsg_input_read()
.