Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Close outside Serve(c)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzEq committed Apr 26, 2024
1 parent 080a4cd commit 2354d3a
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion proxy/socks5/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ func (self *Server) handleConnect(c net.Conn, req Request) error {
}

func (self *Server) Serve(c net.Conn) error {
defer c.Close()
if err := self.exchangeMetadata(c); err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions relayer/intrinsic.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (self *IntrinsicRelayer) ServeAsLocalRelayer(c net.Conn) {
UDPAddr: self.udpAddr,
Dial: context.Dial,
}
defer c.Close()
s.Serve(c)
}

Expand Down
1 change: 1 addition & 0 deletions relayer/socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func (self *SocksRelayer) ServeAsEndRelayer(red net.Conn) {
core.RunSimpleSwitch(core.NewPort(red, CreateProtocol(self.RelayProtocol)),
core.NewPort(blue[0], nil))
}()
defer blue[1].Close()
server := &socks5.Server{}
server.Serve(blue[1])
}
1 change: 1 addition & 0 deletions s5/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func main() {
return
}
go func(c net.Conn) {
defer c.Close()
s := socks5.Server{
UDPAddr: udpAddr,
}
Expand Down

0 comments on commit 2354d3a

Please sign in to comment.