From 45c8945c68c37f20fc4fb57a79c437c555b3edde 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: Fri, 16 Aug 2024 23:46:21 +0800 Subject: [PATCH] fix(link): listen integer divide by zero --- gold/link/me.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gold/link/me.go b/gold/link/me.go index 8ed8b68..221b9d0 100644 --- a/gold/link/me.go +++ b/gold/link/me.go @@ -90,6 +90,10 @@ func NewMe(cfg *MyConfig) (m Me) { } m.me = ip m.subnet = *cidr + m.speedloop = cfg.SpeedLoop + if m.speedloop == 0 { + m.speedloop = 4096 + } m.conn, err = m.listen() if err != nil { panic(err) @@ -110,10 +114,6 @@ func NewMe(cfg *MyConfig) (m Me) { strconv.FormatUint(uint64(m.MTU()), 10), cfg.NICConfig.CIDRs..., ) } - m.speedloop = cfg.SpeedLoop - if m.speedloop == 0 { - m.speedloop = 4096 - } m.mask = cfg.Mask var buf [8]byte binary.BigEndian.PutUint64(buf[:], m.mask)