mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-06-21 11:49:55 +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() {
|
go func() {
|
||||||
// TCP to QUIC
|
// TCP to QUIC
|
||||||
errChan <- utils.Pipe(conn, stream, &c.outboundBytes)
|
errChan <- utils.Pipe(conn, stream, &c.outboundBytes)
|
||||||
_ = conn.Close()
|
|
||||||
_ = stream.Close()
|
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
// QUIC to TCP
|
// QUIC to TCP
|
||||||
errChan <- utils.Pipe(stream, conn, &c.inboundBytes)
|
errChan <- utils.Pipe(stream, conn, &c.inboundBytes)
|
||||||
_ = conn.Close()
|
|
||||||
_ = stream.Close()
|
|
||||||
}()
|
}()
|
||||||
// We only need the first error
|
// We only need the first error
|
||||||
err = <-errChan
|
err = <-errChan
|
||||||
|
@ -165,14 +165,10 @@ func (s *QUICServer) handleStream(addr net.Addr, name string, stream quic.Stream
|
|||||||
go func() {
|
go func() {
|
||||||
// TCP to QUIC
|
// TCP to QUIC
|
||||||
errChan <- utils.Pipe(tcpConn, stream, &s.outboundBytes)
|
errChan <- utils.Pipe(tcpConn, stream, &s.outboundBytes)
|
||||||
_ = tcpConn.Close()
|
|
||||||
_ = stream.Close()
|
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
// QUIC to TCP
|
// QUIC to TCP
|
||||||
errChan <- utils.Pipe(stream, tcpConn, &s.inboundBytes)
|
errChan <- utils.Pipe(stream, tcpConn, &s.inboundBytes)
|
||||||
_ = tcpConn.Close()
|
|
||||||
_ = stream.Close()
|
|
||||||
}()
|
}()
|
||||||
// We only need the first error
|
// We only need the first error
|
||||||
err = <-errChan
|
err = <-errChan
|
||||||
|
Loading…
x
Reference in New Issue
Block a user