mirror of
https://github.com/apernet/hysteria.git
synced 2025-04-04 21:17:47 +03:00
Remove unnecessary closures
This commit is contained in:
parent
3b6a2bc56e
commit
78f6eece9f
2 changed files with 4 additions and 4 deletions
|
@ -48,7 +48,7 @@ func (r *Relay) ListenAndServe() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go func(c *net.TCPConn) {
|
go func() {
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
r.ConnFunc(c.RemoteAddr())
|
r.ConnFunc(c.RemoteAddr())
|
||||||
rc, err := r.HyClient.DialTCP(r.Remote)
|
rc, err := r.HyClient.DialTCP(r.Remote)
|
||||||
|
@ -59,6 +59,6 @@ func (r *Relay) ListenAndServe() error {
|
||||||
defer rc.Close()
|
defer rc.Close()
|
||||||
err = utils.PipePairWithTimeout(c, rc, r.Timeout)
|
err = utils.PipePairWithTimeout(c, rc, r.Timeout)
|
||||||
r.ErrorFunc(c.RemoteAddr(), err)
|
r.ErrorFunc(c.RemoteAddr(), err)
|
||||||
}(c)
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ func (s *Server) ListenAndServe() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go func(c *net.TCPConn) {
|
go func() {
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
if s.TCPTimeout != 0 {
|
if s.TCPTimeout != 0 {
|
||||||
if err := c.SetDeadline(time.Now().Add(s.TCPTimeout)); err != nil {
|
if err := c.SetDeadline(time.Now().Add(s.TCPTimeout)); err != nil {
|
||||||
|
@ -139,7 +139,7 @@ func (s *Server) ListenAndServe() error {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_ = s.handle(c, r)
|
_ = s.handle(c, r)
|
||||||
}(c)
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue