From 27aba99e6c6c1d03dff3912bd5345cddeeaae26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 2 Mar 2023 16:40:28 +0800 Subject: [PATCH] Fix command client connect --- experimental/libbox/command_client.go | 2 ++ experimental/libbox/command_log.go | 1 - experimental/libbox/command_status.go | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/experimental/libbox/command_client.go b/experimental/libbox/command_client.go index e37ce3f5..574a7d1a 100644 --- a/experimental/libbox/command_client.go +++ b/experimental/libbox/command_client.go @@ -53,12 +53,14 @@ func (c *CommandClient) Connect() error { } switch c.options.Command { case CommandLog: + c.handler.Connected() go c.handleLogConn(conn) case CommandStatus: err = binary.Write(conn, binary.BigEndian, c.options.StatusInterval) if err != nil { return E.Cause(err, "write interval") } + c.handler.Connected() go c.handleStatusConn(conn) } return nil diff --git a/experimental/libbox/command_log.go b/experimental/libbox/command_log.go index 3555c616..c8c7a3e2 100644 --- a/experimental/libbox/command_log.go +++ b/experimental/libbox/command_log.go @@ -78,7 +78,6 @@ func (s *CommandServer) handleLogConn(conn net.Conn) error { } func (c *CommandClient) handleLogConn(conn net.Conn) { - c.handler.Connected() for { message, err := readLog(conn) if err != nil { diff --git a/experimental/libbox/command_status.go b/experimental/libbox/command_status.go index cef9a4eb..a9731413 100644 --- a/experimental/libbox/command_status.go +++ b/experimental/libbox/command_status.go @@ -48,7 +48,6 @@ func (s *CommandServer) handleStatusConn(conn net.Conn) error { } func (c *CommandClient) handleStatusConn(conn net.Conn) { - c.handler.Connected() for { var message StatusMessage err := binary.Read(conn, binary.BigEndian, &message)