You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this is inefficient in that it will always send a request after the interval, even if some other packet was received over the connection confirming that the connection is alive. I'd like a way to send keep alives only if no data has been received over the connection in X amount of time.
I could wrap the net.Conn with my own interface to implement this (create a timer and reset it every time some data is read, and if the timer hits 0, send a keep alive) but I think this is a feature that deserves a easy to use solution as part of the library.
The text was updated successfully, but these errors were encountered:
Not sure if it's a significant problem, it's a matter of efficiency. I'll admit it's somewhat a premature optimization but network roundtrips are expensive and if we can easily avoid one, we should.
Nope, I did not know that. However, I still think we should add this because SSH is often used over a very poor connection where those extra roundtrips could become significant.
I know this is all highly hypothetical and I don't have the time right now to benchmark or get data on this so if you don't find my argument convincing, feel free to close.
In order to implement SSH Keep Alives, I'm currently doing something like this:
(conn is the net.Conn underlying the ssh client)
However, this is inefficient in that it will always send a request after the interval, even if some other packet was received over the connection confirming that the connection is alive. I'd like a way to send keep alives only if no data has been received over the connection in X amount of time.
I could wrap the net.Conn with my own interface to implement this (create a timer and reset it every time some data is read, and if the timer hits 0, send a keep alive) but I think this is a feature that deserves a easy to use solution as part of the library.
The text was updated successfully, but these errors were encountered: