From e6a11180b2351e60b433539b769a50852178143b Mon Sep 17 00:00:00 2001 From: qowevisa Date: Fri, 15 Mar 2024 17:56:58 +0200 Subject: [PATCH] Add more states on connecting with tls --- tui/funcs.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tui/funcs.go b/tui/funcs.go index d2c13bc..811a325 100644 --- a/tui/funcs.go +++ b/tui/funcs.go @@ -68,19 +68,21 @@ func FE_ConnectTLS(t *TUI, data dataT) error { config := &tls.Config{ RootCAs: roots, } + if t.stateChannel == nil { + return errors.WrapErr("t.stateChannel", errors.NOT_INIT) + } + t.stateChannel <- "TLS Connecting" conn, err := tls.Dial( "tcp", fmt.Sprintf("%s:%d", host, int(port)), config, ) if err != nil { + t.stateChannel <- "TLS Connection error" return errors.WrapErr("tls.Dial", err) } + t.stateChannel <- "TLS Established" t.tlsConnection = conn - if t.stateChannel == nil { - return errors.WrapErr("t.stateChannel", errors.NOT_INIT) - } - t.stateChannel <- "TLS Connected" t.isConnected = true ctx, cancel := context.WithCancel(context.Background()) wg := &sync.WaitGroup{}