mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-24 17:41:29 +00:00
platform: Remove duplicated close
This commit is contained in:
parent
3c24411e14
commit
f8c400cffc
|
@ -30,7 +30,6 @@ func (c *CommandClient) SetClashMode(newMode string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleSetClashMode(conn net.Conn) error {
|
func (s *CommandServer) handleSetClashMode(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
newMode, err := rw.ReadVString(conn)
|
newMode, err := rw.ReadVString(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -61,7 +60,6 @@ func (c *CommandClient) handleModeConn(conn net.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleModeConn(conn net.Conn) error {
|
func (s *CommandServer) handleModeConn(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
ctx := connKeepAlive(conn)
|
ctx := connKeepAlive(conn)
|
||||||
for s.service == nil {
|
for s.service == nil {
|
||||||
select {
|
select {
|
||||||
|
@ -73,7 +71,6 @@ func (s *CommandServer) handleModeConn(conn net.Conn) error {
|
||||||
}
|
}
|
||||||
clashServer := s.service.instance.Router().ClashServer()
|
clashServer := s.service.instance.Router().ClashServer()
|
||||||
if clashServer == nil {
|
if clashServer == nil {
|
||||||
defer conn.Close()
|
|
||||||
return binary.Write(conn, binary.BigEndian, uint16(0))
|
return binary.Write(conn, binary.BigEndian, uint16(0))
|
||||||
}
|
}
|
||||||
err := writeClashModeList(conn, clashServer)
|
err := writeClashModeList(conn, clashServer)
|
||||||
|
|
|
@ -58,7 +58,6 @@ func (c *CommandClient) handleGroupConn(conn net.Conn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleGroupConn(conn net.Conn) error {
|
func (s *CommandServer) handleGroupConn(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
ctx := connKeepAlive(conn)
|
ctx := connKeepAlive(conn)
|
||||||
for {
|
for {
|
||||||
service := s.service
|
service := s.service
|
||||||
|
@ -274,7 +273,6 @@ func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleSetGroupExpand(conn net.Conn) error {
|
func (s *CommandServer) handleSetGroupExpand(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
groupTag, err := rw.ReadVString(conn)
|
groupTag, err := rw.ReadVString(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -31,7 +31,6 @@ func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleSelectOutbound(conn net.Conn) error {
|
func (s *CommandServer) handleSelectOutbound(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
groupTag, err := rw.ReadVString(conn)
|
groupTag, err := rw.ReadVString(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -35,7 +35,6 @@ func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleGetSystemProxyStatus(conn net.Conn) error {
|
func (s *CommandServer) handleGetSystemProxyStatus(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
status := s.handler.GetSystemProxyStatus()
|
status := s.handler.GetSystemProxyStatus()
|
||||||
err := binary.Write(conn, binary.BigEndian, status.Available)
|
err := binary.Write(conn, binary.BigEndian, status.Available)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -68,7 +67,6 @@ func (c *CommandClient) SetSystemProxyEnabled(isEnabled bool) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleSetSystemProxyEnabled(conn net.Conn) error {
|
func (s *CommandServer) handleSetSystemProxyEnabled(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
var isEnabled bool
|
var isEnabled bool
|
||||||
err := binary.Read(conn, binary.BigEndian, &isEnabled)
|
err := binary.Read(conn, binary.BigEndian, &isEnabled)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -33,7 +33,6 @@ func (c *CommandClient) URLTest(groupTag string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) handleURLTest(conn net.Conn) error {
|
func (s *CommandServer) handleURLTest(conn net.Conn) error {
|
||||||
defer conn.Close()
|
|
||||||
groupTag, err := rw.ReadVString(conn)
|
groupTag, err := rw.ReadVString(conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue