5 ms·
Wow. Can you easily change the tcp connection timeout?
by rattray 4y ago
Wow. Can you easily change the tcp connection timeout?
- iampims 4y agoYou can. It’s trivial once you know it’s possible. Not sure why it’s not set by default. https://go.googlesource.com/net/+/master/http2/transport.go https://go.googlesource.com/net/+/master/http2/transport.go
- klabb3 4y agoTo be clear, this is for http/2, not tcp. You can very easily set read and write deadlines on tcp conns, but you can’t detect if a peer has disappeared without data. You can set keepalive but it’s not reliable and varies wildly between OSs. You need a heartbeat or ping message together with an advancing deadline to detect dead peers reliably.
- benmmurphy 4y agoHTTP/2 supports a heartbeat in the protocol using PING frames. But I guess a lot of clients probably don’t support it or use it by default.