From 505fc23447541f5164dcd95aae9900193bab273d Mon Sep 17 00:00:00 2001 From: Nonoo Date: Wed, 28 Oct 2020 22:11:57 +0100 Subject: [PATCH] Don't wait a lot when got radio disconnected message --- main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index ada5acf..d8de00b 100644 --- a/main.go +++ b/main.go @@ -42,9 +42,13 @@ func runControlStream(osSignal chan os.Signal) (shouldExit bool, exitCode int) { } select { - case <-gotErrChan: + case requireWait := <-gotErrChan: ctrl.deinit() + if !requireWait { + return + } + // Need to wait before reinit because the IC-705 will disconnect our audio stream eventually if we relogin // in a too short interval without a deauth... t := time.NewTicker(time.Second) @@ -69,9 +73,14 @@ func reportError(err error) { log.ErrorC(log.GetCallerFileName(true), ": ", err) } + requireWait := true + if strings.Contains(err.Error(), "got radio disconnected") { + requireWait = false + } + // Non-blocking notify. select { - case gotErrChan <- false: + case gotErrChan <- requireWait: default: } }