diff options
author | delthas <delthas@dille.cc> | 2022-04-08 16:48:10 +0200 |
---|---|---|
committer | delthas <delthas@dille.cc> | 2022-04-08 16:48:10 +0200 |
commit | 25ae442096764560d79badd251274e70ead12063 (patch) | |
tree | ec49891c708f60ed1992f476a52193414dc3e049 /app.go | |
parent | Add HTTPS schema by default to hyperlinks (diff) |
Add a 15s keepalive to connections
My DSL line is awful atm, I'd like to know ASAP when I'm disconnected so
that I don't write paragraphs into the void.
Diffstat (limited to 'app.go')
-rw-r--r-- | app.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -351,6 +351,11 @@ func (app *App) tryConnect() (conn net.Conn, err error) { return } + if tcpConn, ok := conn.(*net.TCPConn); ok { + tcpConn.SetKeepAlive(true) + tcpConn.SetKeepAlivePeriod(15 * time.Second) + } + if app.cfg.TLS { host, _, _ := net.SplitHostPort(addr) // should succeed since net.Dial did. conn = tls.Client(conn, &tls.Config{ |