What's the best way to implement "idle timeouts"?

Again a question for GitHub - git001/tls-proxy-tunnel :slight_smile:

Let's say there are some buggy clients which does not close connections. We can call it 'hanging connections' or 'dead connections' what ever the common wording in rust is.

What I have seen is that there are some read,write and connection timeout solutions but haven't seen any about idle timeout.

https://docs.rs/releases/search?query=timeout

What do I mean with "Idle timeout"?
When there is no traffic for "duration(x)".

I think that this idle timeout should be implemented in the copy call but I would like to here some opinions and maybe how other have implemented such timeout

Are you searching for a way to set the TCP_USER_TIMEOUT value?

Does any of this help?

Well, partly.

I would like to close actively the socket when no data exchange is done anymore and would not like that the kernel drops the connection silently.

Is there an easy option to set TCP_USER_TIMEOUT for the std::tcpstream or tokio tcpstream?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.