Release audio resources before reconnecting

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 14:50:01 -04:00
committed by Brandon McGinty
parent 25467405b8
commit d07d7342da
4 changed files with 27 additions and 1 deletions
+17
View File
@@ -81,6 +81,23 @@ type Barnard struct {
adminACL *gumble.ACL
}
// cleanupConnectionAudio releases connection-owned audio resources before a
// reconnect replaces them. It is intentionally idempotent for repeated
// disconnect notifications.
func (b *Barnard) cleanupConnectionAudio() {
if b.Stream != nil {
stream := b.Stream
b.Stream = nil
stream.Destroy()
}
b.FileStreamMutex.Lock()
if b.FileStream != nil {
_ = b.FileStream.Stop()
b.FileStream = nil
}
b.FileStreamMutex.Unlock()
}
func (b *Barnard) StopTransmission() {
if b.Tx {
b.Notify("micdown", "me", "")