Skip to content

v0.5.4: fix: don't SO_REUSEADDR in open_sonar_udp_unicast_socket - #12

Merged
tholok97 merged 1 commit into
mainfrom
fix-unicast-reuseaddr
Aug 6, 2026
Merged

v0.5.4: fix: don't SO_REUSEADDR in open_sonar_udp_unicast_socket#12
tholok97 merged 1 commit into
mainfrom
fix-unicast-reuseaddr

Conversation

@tholok97

@tholok97 tholok97 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

See commit message.

SO_REUSEADDR in open_sonar_udp_unicast_socket meant that multiple unicast
sockets could be open at the same time. This is misleading on Linux as packets
only arrive in one of them at a time, seemingly the last opened socket.

Avoid this confusion by removing SO_REUSEADDR from
open_sonar_udp_unicast_socket. With this change, an attempt to open a second
unicast socket will raise an exception instead.

Also close sockets on exception during open_sonar_*_socket functions.

And also update the UDP record example: It used to always open a multicast
socket (which seems to also get unicast data), but now it supports choosing
with --udp-mode, and verifying unicast configuration destination IP and port
when passing --verify. Also update imu example in a similar way.

Note on version bump: Since the intended behavior of doing two calls to
open_sonar_udp_unicast_socket is not documented, changing code to raise on the
second call could be seen as a breaking change. But because wlsonar has very
few users, and because I don't see a use case for wanting to open multiple
sockets with open_sonar_udp_unicast_socket, I'm treating it as a patch update
v0.5.3 -> v0.5.4
@tholok97
tholok97 requested a review from wlkh August 6, 2026 11:52
@tholok97
tholok97 merged commit 0cf06a9 into main Aug 6, 2026
15 checks passed
@tholok97
tholok97 deleted the fix-unicast-reuseaddr branch August 6, 2026 14:22
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