mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 18:11:28 +00:00
Fix command client connect
This commit is contained in:
parent
8151bcfd6b
commit
27aba99e6c
|
@ -53,12 +53,14 @@ func (c *CommandClient) Connect() error {
|
||||||
}
|
}
|
||||||
switch c.options.Command {
|
switch c.options.Command {
|
||||||
case CommandLog:
|
case CommandLog:
|
||||||
|
c.handler.Connected()
|
||||||
go c.handleLogConn(conn)
|
go c.handleLogConn(conn)
|
||||||
case CommandStatus:
|
case CommandStatus:
|
||||||
err = binary.Write(conn, binary.BigEndian, c.options.StatusInterval)
|
err = binary.Write(conn, binary.BigEndian, c.options.StatusInterval)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "write interval")
|
return E.Cause(err, "write interval")
|
||||||
}
|
}
|
||||||
|
c.handler.Connected()
|
||||||
go c.handleStatusConn(conn)
|
go c.handleStatusConn(conn)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -78,7 +78,6 @@ func (s *CommandServer) handleLogConn(conn net.Conn) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CommandClient) handleLogConn(conn net.Conn) {
|
func (c *CommandClient) handleLogConn(conn net.Conn) {
|
||||||
c.handler.Connected()
|
|
||||||
for {
|
for {
|
||||||
message, err := readLog(conn)
|
message, err := readLog(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -48,7 +48,6 @@ func (s *CommandServer) handleStatusConn(conn net.Conn) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CommandClient) handleStatusConn(conn net.Conn) {
|
func (c *CommandClient) handleStatusConn(conn net.Conn) {
|
||||||
c.handler.Connected()
|
|
||||||
for {
|
for {
|
||||||
var message StatusMessage
|
var message StatusMessage
|
||||||
err := binary.Read(conn, binary.BigEndian, &message)
|
err := binary.Read(conn, binary.BigEndian, &message)
|
||||||
|
|
Loading…
Reference in a new issue