When a TcpSession failed to connect to a backend (max retries reached, no backend available, connection error...) the error was ignored and the Session would remain dormant until a timeout occurred. This let the client connection hang for no apparent reason even though Sozu knew the connection could not be established.
The first commit homogenizes the TCP session and HTTP state handling of connection results, ensuring every case is treated. In the case of TCP, any connection error will trigger a session close, letting the client know the connection failed with minimal delay.
The second commit homogenizes the TCP states to use SessionResult when possible, reducing the number of cases to treat in the upper layers. They still do not implement SessionState.
When a TcpSession failed to connect to a backend (max retries reached, no backend available, connection error...) the error was ignored and the Session would remain dormant until a timeout occurred. This let the client connection hang for no apparent reason even though Sozu knew the connection could not be established. The first commit homogenizes the TCP session and HTTP state handling of connection results, ensuring every case is treated. In the case of TCP, any connection error will trigger a session close, letting the client know the connection failed with minimal delay. The second commit homogenizes the TCP states to use SessionResult when possible, reducing the number of cases to treat in the upper layers. They still do not implement SessionState.