Skip to content

Fix TCPServer address detection failing#66

Open
aschampion wants to merge 1 commit intofunkelab:masterfrom
aschampion:pr/fix-tcpserver-address-detection-failing
Open

Fix TCPServer address detection failing#66
aschampion wants to merge 1 commit intofunkelab:masterfrom
aschampion:pr/fix-tcpserver-address-detection-failing

Conversation

@aschampion
Copy link
Contributor

Discovered while attempting to run tests for #65

The _get_address method uses a UDP-to-8.8.8.8 method to find the default
route IP, but in some environments this may not be the correct interface
or this method may not work. For example, macOS's application firewall
blocks recv on non-loopback interfaces, causing ENOTCONN on all TCP
tests. Add _validate_address to verify the detected IP works with a
loopback TCP test, falling back to 127.0.0.1. Add optional host
parameter in Server and TCPServer for explicit address configuration
when needed.

LLM disclosure: while I diagnosed and debugged the root issue, LLMs were used to exclude other causes and draft fixes. But all code here has been human reviewed or created.

The _get_address method uses a UDP-to-8.8.8.8 method to find the default
route IP, but in some environments this may not be the correct interface
or this method may not work. For example, macOS's application firewall
blocks recv on non-loopback interfaces, causing ENOTCONN on all TCP
tests. Add _validate_address to verify the detected IP works with a
loopback TCP test, falling back to 127.0.0.1. Add optional host
parameter in Server and TCPServer for explicit address configuration
when needed.
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.

1 participant