Skip to content

Commit 12e6830

Browse files
committed
Fix anti-interupt transmission delay
1 parent 1c777e4 commit 12e6830

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/simpleradio/audio/transmit.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ func (c *audioClient) transmit(ctx context.Context, packetCh <-chan []voice.Voic
2929
}
3030

3131
func (c *audioClient) tx(packets []voice.VoicePacket) {
32-
if c.lastRx.deadline.After(time.Now()) {
33-
delay := 250 * time.Millisecond
32+
for c.lastRx.deadline.After(time.Now()) {
33+
delay := time.Until(c.lastRx.deadline) + 250*time.Millisecond
3434
log.Info().Dur("delay", delay).Msg("delaying outgoing transmission to avoid interrupting incoming transmission")
3535
time.Sleep(delay)
3636
}

0 commit comments

Comments
 (0)