reactphp / socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.
https://reactphp.org/socket/
MIT License
1.2k stars 156 forks source link

Improve error reporting to include both IPv6 & IPv4 errors (happy eyeballs) #233

Closed clue closed 4 years ago

clue commented 4 years ago

This changeset improves error reporting for failed connection attempts using happy eyeballs to always include the last error message for both IPv6 and IPv4 protocol families. The rationale for this is that both families commonly fail for very different reasons (broken IPv6 connectivity etc.). If both families report the same error, the message will only include a single message:

Connection to foo.invalid failed during DNS lookup: DNS query for foo.invalid returned an error response (Server Failure)

Connection to asdasd.com failed: Last error for IPv4: Given URI "tcp://127.0.0.1?hostname=asdasd.com" is invalid. Previous error for IPv6: DNS query for asdasd.com did not return a valid answer (NOERROR / NODATA)

Builds on top of #232, #231, #230, #224 and #225 Refs #171 and others