Skip to content

fix: --count exists without waiting for extra input message#182

Open
regalk13 wants to merge 1 commit into
nextfrom
fix-count-stop
Open

fix: --count exists without waiting for extra input message#182
regalk13 wants to merge 1 commit into
nextfrom
fix-count-stop

Conversation

@regalk13
Copy link
Copy Markdown

@regalk13 regalk13 commented Feb 5, 2026

Fixes issue of --count

Prev:

--count=1
...
nmsg_io: iothr=0x5586bf6c3590 count_nmsg_payload_in=2
nmsgtool: totals: payloads_in 2 payloads_out 1 container_recvs 1 container_drops 0

Now:

--count=1
...
nmsg_io: iothr=0x5634f5432590 count_nmsg_payload_in=1
nmsgtool: totals: payloads_in 1 payloads_out 1 container_recvs 1 container_drops 0

Tested with -r flag with nmsg files and json inputs.

Copy link
Copy Markdown
Contributor

@cmikk cmikk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting a fix of stray whitespace, and more investigation into the implications of moving the check_close_event call after the write instead of before.

If that move is valid, then reset_close_event should be folded into check_close_event.

Comment thread nmsg/io.c
if (res != nmsg_res_success)
return (res);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit adds stray whitespace on this and one other line, a common editor artifact.

git diff --check will show these before adding, and git diff --cached --check will show these before committing. I have the latter set up in a pre-commit hook script so I don't forget myself :)

Comment thread nmsg/io.c

/* It's possible a set "count" has been reached. */
check_close_event(iothr, io_output, 1);
reset_close_event(iothr, io_output);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change results in check_close_event and reset_close_event being called as a pair both places they are called, meaning that the reset_close_event code could be merged into check_close_event.

However, they were affirmatively separated at the last refactor of this code: before commit 77f40, check_close_event was a single function called after the top-level write. That commit split it into check_close_event and reset_close_event, with the underlying write call in between. I do not recall the precise reason I did that ~3 years ago, but it must have been sufficiently compelling to add the reset_close_event function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants