summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-04-08 16:48:10 +0200
committerdelthas <delthas@dille.cc>2022-04-08 16:48:10 +0200
commit25ae442096764560d79badd251274e70ead12063 (patch)
treeec49891c708f60ed1992f476a52193414dc3e049 /app.go
parentAdd 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.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/app.go b/app.go
index 3b34bd8..c0f0112 100644
--- a/app.go
+++ b/app.go
@@ -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{