SocketConnectFix
Requiring this file changes Socket#connect for the whole program.
After the event loop reports a connection as established, the kernel's pending
socket error (SO_ERROR) is checked. A non-zero value is yielded as a
Socket::ConnectError, exactly as an immediate failure would be.
Effects:
TCPSocket.new(host, port)tries the next resolved address when an earlier one refused, e.g.localhostfalls back from::1to127.0.0.1.- A refused connection raises
Socket::ConnectErrorat construction instead of returning a socket that fails on first use.
Applies to every TCPSocket, including those created by HTTP::Client and
database drivers. Has no effect on Windows.
Compile with -Dsocket_connect_fix_disabled to leave Socket#connect
untouched, e.g. to check whether the underlying Crystal bug is still present.
Constants
SO_ERROR = 4
VERSION = {{ (`shards version /tmp/tmp.DLLAeL/src/src`).chomp.stringify }}