reactphp / socket

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

Improve error messages when accepting connections with errno/errstr #267

Closed clue closed 3 years ago

clue commented 3 years ago

This changeset improves the error messages for failed incoming connections to include the appropriate errno/errstr. Reporting the errstr works on all supported platforms, the errno is only available when ext-sockets is available. Whereas it would previously report a generic "Error accepting new connection" error, it will now report the actual underlying error condition, such as this:

-Error accepting new connection
+Failed to accept new connection: Connection timed out

Builds on top of #266, #265, #171, https://github.com/reactphp/dns/pull/171, https://github.com/reactphp/dns/pull/172 and others Together with #244 this is a prerequisite for #164