mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-04-09 02:13:35 +00:00
timeout now a flag on the root command.
It applies to all messages sent new option function WithTimeout added
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user