Skip to content

Conversation

@TrentHouliston
Copy link
Member

@TrentHouliston TrentHouliston commented Aug 11, 2025

This pull request refactors how socket options are set for UDP sockets, improving consistency and reliability in both the main UDP implementation and the emit path. The changes focus on ensuring proper reuse of addresses and ports, and on clarifying when broadcast options are set.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables UDP sockets to bind to the same IP address and port combination by adding socket reuse options. The changes allow multiple UDP sockets to share the same address/port, which is useful for scenarios like load balancing or multiple listeners.

  • Adds SO_REUSEADDR and SO_REUSEPORT socket options to UDP emit functionality
  • Removes conditional logic that previously restricted reuse options to only broadcast/multicast
  • Removes duplicate broadcast socket option setting

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/dsl/word/emit/UDP.hpp Adds socket reuse options and moves variable declaration to avoid duplication
src/dsl/word/UDP.hpp Removes broadcast/multicast-only restriction for socket reuse options
Comments suppressed due to low confidence (1)

src/dsl/word/UDP.hpp:210

  • The variable yes is being used but was not declared in this scope after removing the conditional block. The variable declaration needs to be added before this line.
                if (::setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast<char*>(&yes), sizeof(yes)) < 0) {

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@TrentHouliston TrentHouliston marked this pull request as ready for review August 27, 2025 01:17
@TrentHouliston TrentHouliston merged commit 9758634 into main Aug 27, 2025
12 of 14 checks passed
@TrentHouliston TrentHouliston deleted the houliston/udp-freedom branch August 27, 2025 01:17
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.

3 participants