Re:Golang is evil on shitty networks
by rattray on Thursday December 29, 2022 @08:08PM
(#34180361)
Wow. Can you easily change the tcp connection timeout?
[ Parent
| on HN ]
You 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
To 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.
Re:Golang is evil on shitty networks
by benmmurphy on Friday December 30, 2022 @09:36AM
(#34185375)
HTTP/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.