Cancel reconnect retries during shutdown

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-10 10:24:38 -04:00
committed by Brandon McGinty
parent e68546eec5
commit 1d6ab79ed0
4 changed files with 51 additions and 5 deletions
+9 -5
View File
@@ -14,6 +14,7 @@ import (
)
func (b *Barnard) start() {
b.reconnectStop = make(chan struct{})
b.Config.Attach(gumbleutil.AutoBitrate)
b.Config.Attach(b)
b.Config.Address = b.Address
@@ -218,12 +219,15 @@ func (b *Barnard) OnDisconnect(e *gumble.DisconnectEvent) {
}
func (b *Barnard) reconnectGoroutine() {
for {
res := b.connect(true)
if res == true {
break
for !b.reconnectCanceled() {
if b.connect(true) {
return
}
select {
case <-b.reconnectStop:
return
case <-time.After(15 * time.Second):
}
time.Sleep(15 * time.Second)
}
}