mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 18:11:28 +00:00
Fix write log to stderr
This commit is contained in:
parent
8699412a4c
commit
f7f9a7ae20
|
@ -63,7 +63,7 @@ func (s *CommandServer) handleLogConn(conn net.Conn) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return ctx.Err()
|
||||||
case message := <-subscription:
|
case message := <-subscription:
|
||||||
err = writeLog(conn, []byte(message))
|
err = writeLog(conn, []byte(message))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
|
"github.com/sagernet/sing/common/debug"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
"github.com/sagernet/sing/common/observable"
|
"github.com/sagernet/sing/common/observable"
|
||||||
"github.com/sagernet/sing/common/x/list"
|
"github.com/sagernet/sing/common/x/list"
|
||||||
|
@ -71,8 +72,10 @@ func (s *CommandServer) loopConnection(listener net.Listener) {
|
||||||
go func() {
|
go func() {
|
||||||
hErr := s.handleConnection(conn)
|
hErr := s.handleConnection(conn)
|
||||||
if hErr != nil && !E.IsClosed(err) {
|
if hErr != nil && !E.IsClosed(err) {
|
||||||
|
if debug.Enabled {
|
||||||
log.Warn("log-server: process connection: ", hErr)
|
log.Warn("log-server: process connection: ", hErr)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ func (s *CommandServer) handleStatusConn(conn net.Conn) error {
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return ctx.Err()
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue