1
0
mirror of https://github.com/stryan/mumble-discord-bridge.git synced 2024-11-22 21:35:44 -05:00

allow discord send loop to exit with ctx done

This commit is contained in:
Tyler Stiene 2021-12-07 22:59:04 -05:00
parent 7dea05bdb4
commit 3e96b27564
3 changed files with 7 additions and 3 deletions

View File

@ -210,7 +210,7 @@ func (b *BridgeState) StartBridge() {
b.DiscordStream.discordSendPCM(ctx, cancel, toDiscord)
}()
// Monitor Mumble
// Monitor
wg.Add(1)
go func() {
defer wg.Done()

View File

@ -110,7 +110,11 @@ func (dd *DiscordDuplex) discordSendPCM(ctx context.Context, cancel context.Canc
lastReady = true
readyTimeout.Stop()
} else {
dd.Bridge.DiscordVoice.OpusSend <- opus
select {
case dd.Bridge.DiscordVoice.OpusSend <- opus:
case <-ctx.Done():
}
promDiscordSentPackets.Inc()
}
dd.Bridge.DiscordVoice.RWMutex.RUnlock()

View File

@ -85,7 +85,7 @@ var (
promDiscordReceivedPackets = promauto.NewCounter(prometheus.CounterOpts{
Name: "mdb_discord_received_count",
Help: "The number of received packed from Discord",
Help: "The number of received packets from Discord",
})
promDiscordSentPackets = promauto.NewCounter(prometheus.CounterOpts{