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
+23
View File
@@ -83,6 +83,9 @@ type Barnard struct {
adminBanList gumble.BanList
adminUserList gumble.RegisteredUsers
adminACL *gumble.ACL
reconnectStop chan struct{}
reconnectStopOnce sync.Once
}
// cleanupConnectionAudio releases connection-owned audio resources before a
@@ -174,6 +177,26 @@ func (b *Barnard) setConnected(connected bool) {
b.stateMutex.Unlock()
}
func (b *Barnard) stopReconnects() {
b.reconnectStopOnce.Do(func() {
if b.reconnectStop != nil {
close(b.reconnectStop)
}
})
}
func (b *Barnard) reconnectCanceled() bool {
if b.reconnectStop == nil {
return false
}
select {
case <-b.reconnectStop:
return true
default:
return false
}
}
func (b *Barnard) StopTransmission() {
if b.isTransmitting() {
b.Notify("micdown", "me", "")