diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2021-05-26 14:00:29 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-05-26 14:00:29 +0200 |
commit | 98550d817d73d07bdd291b53234ca77195457369 (patch) | |
tree | 9058fe4619e3551ab1f916f2beb3b49d08c99f34 | |
parent | Fix ui tests (diff) |
Do not go into infinite loops on TLS mismatch
- do the TLS eagerly instead of waiting for the first write, so that an
error message can be printed,
- sleep for 10 seconds before reconnecting, otherwise when connecting
without TLS to a TLS server, the connection will always succeed while
the first writes will not.
-rw-r--r-- | app.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -164,6 +164,7 @@ func (app *App) ircLoop() { HeadColor: ui.ColorRed, Body: "Connection lost", }) + time.Sleep(10 * time.Second) } } @@ -211,6 +212,11 @@ func (app *App) tryConnect() (conn net.Conn, err error) { ServerName: host, NextProtos: []string{"irc"}, }) + err = conn.(*tls.Conn).Handshake() + if err != nil { + conn.Close() + return nil, err + } } return |