Add more states on connecting with tls
This commit is contained in:
parent
8006402f0f
commit
e6a11180b2
10
tui/funcs.go
10
tui/funcs.go
|
@ -68,19 +68,21 @@ func FE_ConnectTLS(t *TUI, data dataT) error {
|
||||||
config := &tls.Config{
|
config := &tls.Config{
|
||||||
RootCAs: roots,
|
RootCAs: roots,
|
||||||
}
|
}
|
||||||
|
if t.stateChannel == nil {
|
||||||
|
return errors.WrapErr("t.stateChannel", errors.NOT_INIT)
|
||||||
|
}
|
||||||
|
t.stateChannel <- "TLS Connecting"
|
||||||
conn, err := tls.Dial(
|
conn, err := tls.Dial(
|
||||||
"tcp",
|
"tcp",
|
||||||
fmt.Sprintf("%s:%d", host, int(port)),
|
fmt.Sprintf("%s:%d", host, int(port)),
|
||||||
config,
|
config,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
t.stateChannel <- "TLS Connection error"
|
||||||
return errors.WrapErr("tls.Dial", err)
|
return errors.WrapErr("tls.Dial", err)
|
||||||
}
|
}
|
||||||
|
t.stateChannel <- "TLS Established"
|
||||||
t.tlsConnection = conn
|
t.tlsConnection = conn
|
||||||
if t.stateChannel == nil {
|
|
||||||
return errors.WrapErr("t.stateChannel", errors.NOT_INIT)
|
|
||||||
}
|
|
||||||
t.stateChannel <- "TLS Connected"
|
|
||||||
t.isConnected = true
|
t.isConnected = true
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
wg := &sync.WaitGroup{}
|
wg := &sync.WaitGroup{}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user