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
+17
View File
@@ -193,6 +193,23 @@ func TestCleanupConnectionAudioIsIdempotent(t *testing.T) {
// Tone test mode intentionally does not create an OpenAL stream. Tree
// controls must therefore keep local mute state without trying to update one.
func TestReconnectCancellationIsSafeBeforeStartup(t *testing.T) {
b := &Barnard{}
b.stopReconnects()
if b.reconnectCanceled() {
t.Fatal("nil reconnect channel should not report cancellation")
}
}
func TestReconnectCancellationStopsWaiters(t *testing.T) {
b := &Barnard{reconnectStop: make(chan struct{})}
b.stopReconnects()
if !b.reconnectCanceled() {
t.Fatal("expected reconnect cancellation")
}
b.stopReconnects() // repeated shutdown must not panic
}
func TestUpdateUserGainAllowsToneTestWithoutStream(t *testing.T) {
(&Barnard{ToneTest: true}).updateUserGain(&gumble.User{})
}