gatewayd icon indicating copy to clipboard operation
gatewayd copied to clipboard

Fix bug in handling connection timeouts

Open mostafa opened this issue 1 year ago • 2 comments

When receiveDeadline and sendDeadline are set, the server connections will become stale, while the client connection is still working. There should be a way to recover the connection without breaking the authenticated connections.

Now that both the incoming connection from clients and outgoing connections to the database use net.Conn, it would be beneficial in the long run to have a common structure to manage all these connections. It could be as simple as reusing the Client object and wrapping incoming client connections with it, so that we can set deadlines on both connections at the same time via the same interface. To handle TLS handshake and termination, I did something similar using this ConnWrapper object. It could also be used for this purpose as well, instead of Client.

Refer to docs for more information about the connection lifecycle.

mostafa avatar Mar 09 '23 16:03 mostafa