Skip to content
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

Track last error atomically #5

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

shutton
Copy link

@shutton shutton commented Jul 9, 2024

Eliminate the need for UdpSocket to be passed mutably into send_mmsg().

While this reduces the granularity at which error messages can be logged to one second, that value wasn't configurable, and was at a very large value (60 seconds). As such, it's simple to use an atomic integer to track the last report, which eliminates the need to pass the socket in mutably to UdpSocket::send_mmsg.

This addressed a small issue in one of my projects with respect to how sockets are shared between threads.

@shutton shutton force-pushed the track-last-error-atomically branch 3 times, most recently from f002d49 to 8ccd2ac Compare July 10, 2024 03:54
@shutton shutton marked this pull request as ready for review July 10, 2024 23:32
@leshow
Copy link
Owner

leshow commented Jul 11, 2024

cool! thanks for the PR

src/unix.rs Outdated Show resolved Hide resolved
@shutton shutton force-pushed the track-last-error-atomically branch from 8ccd2ac to 1654e25 Compare July 11, 2024 17:03
Eliminate the need for UdpSocket to be passed mutably into send_mmsg().
@shutton shutton force-pushed the track-last-error-atomically branch from 1654e25 to fcb6301 Compare July 11, 2024 17:05
@leshow leshow merged commit edfbee4 into leshow:master Jul 12, 2024
8 checks passed
@leshow
Copy link
Owner

leshow commented Jul 12, 2024

thanks again for the contribution

@shutton
Copy link
Author

shutton commented Jul 12, 2024

My pleasure! Thanks for taking the patch so quickly.

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