mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-21 03:39:51 +00:00
forwarder: remove redundant closes in pipe goroutines
This commit is contained in:
parent
f0c647004f
commit
34198cd879
@ -192,14 +192,10 @@ func (c *QUICClient) handleConn(conn net.Conn) {
|
||||
go func() {
|
||||
// TCP to QUIC
|
||||
errChan <- utils.Pipe(conn, stream, &c.outboundBytes)
|
||||
_ = conn.Close()
|
||||
_ = stream.Close()
|
||||
}()
|
||||
go func() {
|
||||
// QUIC to TCP
|
||||
errChan <- utils.Pipe(stream, conn, &c.inboundBytes)
|
||||
_ = conn.Close()
|
||||
_ = stream.Close()
|
||||
}()
|
||||
// We only need the first error
|
||||
err = <-errChan
|
||||
|
@ -165,14 +165,10 @@ func (s *QUICServer) handleStream(addr net.Addr, name string, stream quic.Stream
|
||||
go func() {
|
||||
// TCP to QUIC
|
||||
errChan <- utils.Pipe(tcpConn, stream, &s.outboundBytes)
|
||||
_ = tcpConn.Close()
|
||||
_ = stream.Close()
|
||||
}()
|
||||
go func() {
|
||||
// QUIC to TCP
|
||||
errChan <- utils.Pipe(stream, tcpConn, &s.inboundBytes)
|
||||
_ = tcpConn.Close()
|
||||
_ = stream.Close()
|
||||
}()
|
||||
// We only need the first error
|
||||
err = <-errChan
|
||||
|
Loading…
x
Reference in New Issue
Block a user