From aaf30bf92bc4bf4323ee6a15906e26e4a192238f Mon Sep 17 00:00:00 2001 From: hiddify Date: Tue, 6 Feb 2024 15:56:22 +0800 Subject: [PATCH] platform: Fix group update interval not taking effect --- experimental/libbox/command_group.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/experimental/libbox/command_group.go b/experimental/libbox/command_group.go index 7f7f5c57..21fd39d2 100644 --- a/experimental/libbox/command_group.go +++ b/experimental/libbox/command_group.go @@ -58,6 +58,13 @@ func (c *CommandClient) handleGroupConn(conn net.Conn) { } func (s *CommandServer) handleGroupConn(conn net.Conn) error { + var interval int64 + err := binary.Read(conn, binary.BigEndian, &interval) + if err != nil { + return E.Cause(err, "read interval") + } + ticker := time.NewTicker(time.Duration(interval)) + defer ticker.Stop() ctx := connKeepAlive(conn) for { service := s.service @@ -75,7 +82,7 @@ func (s *CommandServer) handleGroupConn(conn net.Conn) error { select { case <-ctx.Done(): return ctx.Err() - case <-time.After(2 * time.Second): + case <-ticker.C: } select { case <-ctx.Done():