Cancel reconnect retries during shutdown
This commit is contained in:
committed by
Brandon McGinty
parent
e68546eec5
commit
1d6ab79ed0
+23
@@ -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", "")
|
||||
|
||||
Reference in New Issue
Block a user