From ce8213869adc644d51cfebad855c5ccbd6d09b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 11 Jul 2024 23:01:18 +0900 Subject: [PATCH] fix(listen): timeout loop --- gold/link/listen.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gold/link/listen.go b/gold/link/listen.go index 86f7fb3..9b7b6dd 100644 --- a/gold/link/listen.go +++ b/gold/link/listen.go @@ -54,6 +54,7 @@ func (m *Me) listenudp() (conn *net.UDPConn, err error) { if err != nil { logrus.Warnln("[listen] set ddl err:", err) } + READ: n, addr, err := conn.ReadFromUDP(lbf) if m.loop == nil { logrus.Warnln("[listen] quit listening") @@ -61,6 +62,7 @@ func (m *Me) listenudp() (conn *net.UDPConn, err error) { } if errors.Is(err, os.ErrDeadlineExceeded) { err = nil + goto READ } if err != nil { logrus.Warnln("[listen] read from udp err, reconnect:", err)