bnclabs/gofast

Auto detection of half open connections.

prataprc opened this issue · 0 comments

Socket Read() and Write() are blocking, in TCP/IP there can be scenarios of half open connections and other un-detectable network errors on the connections.

On approach is to use net/ package's feature of setting Deadline timeouts for reads and writes, but profiling shows that this can lead to performance issues when we scale connections.

Another approach is to use the heart-beat. That is both peers should set the heartbeat, and expose an API to learn when the last heartbeat was received, set a threshold and close the socket after that.
May be we need a separate monitor routine for this.