keep the tone test output open across a reconnect
The saver reserves its output file exclusively, so opening it a second time fails. connect opened a new one per connection and a disconnect closed it, which meant the first reconnect died with "file exists" instead of resuming. Open the saver once and re-attach it on reconnect, and close it on exit instead. Detaching and closing are now separate, since only shutdown wants both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
77fad24560
commit
5cdb2684b5
+10
-1
@@ -116,11 +116,20 @@ func (b *Barnard) cleanupConnectionAudio() {
|
||||
b.connectionMutex.Unlock()
|
||||
}
|
||||
|
||||
func (b *Barnard) cleanupToneTestAudio() {
|
||||
// detachToneTestAudio unsubscribes the saver without closing its output, so a
|
||||
// reconnect can re-attach the same file. The saver's output is opened
|
||||
// exclusively and cannot be reopened.
|
||||
func (b *Barnard) detachToneTestAudio() {
|
||||
if b.toneTestSaverDetach != nil {
|
||||
b.toneTestSaverDetach.Detach()
|
||||
b.toneTestSaverDetach = nil
|
||||
}
|
||||
}
|
||||
|
||||
// cleanupToneTestAudio detaches the saver and closes its output. Use it when
|
||||
// the client is shutting down, not between connections.
|
||||
func (b *Barnard) cleanupToneTestAudio() {
|
||||
b.detachToneTestAudio()
|
||||
if b.toneTestSaver != nil {
|
||||
b.toneTestSaver.Stop()
|
||||
b.toneTestSaver = nil
|
||||
|
||||
Reference in New Issue
Block a user