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:
parent
7dea05bdb4
commit
3e96b27564
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user