timeout now a flag on the root command.

It applies to all messages sent

new option function WithTimeout added
This commit is contained in:
2026-02-06 11:28:40 +00:00
parent 1ad214ba4a
commit 3f8861ded2
13 changed files with 223 additions and 93 deletions

View File

@@ -15,6 +15,7 @@ type parser interface {
type engine struct {
Kind MixerKind
timeout time.Duration
conn *net.UDPConn
mixerAddr *net.UDPAddr
@@ -34,7 +35,7 @@ func (e *engine) receiveLoop() {
case <-e.done:
return
default:
// Set read timeout to avoid blocking forever
// Set a short read deadline to prevent blocking indefinitely
e.conn.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
n, _, err := e.conn.ReadFromUDP(buffer)
if err != nil {