mirror of https://github.com/v2ray/v2ray-core
close pipe when finish
parent
6315217572
commit
bc78e63877
|
@ -58,6 +58,8 @@ func (server *Server) handleConnection(conn net.Conn) {
|
||||||
|
|
||||||
pReader, pWriter := pipe.New(pipe.WithoutSizeLimit())
|
pReader, pWriter := pipe.New(pipe.WithoutSizeLimit())
|
||||||
err := task.Run(task.Parallel(func() error {
|
err := task.Run(task.Parallel(func() error {
|
||||||
|
defer pWriter.Close() // nolint: errcheck
|
||||||
|
|
||||||
for {
|
for {
|
||||||
b := buf.New()
|
b := buf.New()
|
||||||
if err := b.AppendSupplier(buf.ReadFrom(conn)); err != nil {
|
if err := b.AppendSupplier(buf.ReadFrom(conn)); err != nil {
|
||||||
|
@ -72,6 +74,8 @@ func (server *Server) handleConnection(conn net.Conn) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, func() error {
|
}, func() error {
|
||||||
|
defer pReader.CloseError()
|
||||||
|
|
||||||
w := buf.NewWriter(conn)
|
w := buf.NewWriter(conn)
|
||||||
for {
|
for {
|
||||||
mb, err := pReader.ReadMultiBuffer()
|
mb, err := pReader.ReadMultiBuffer()
|
||||||
|
|
Loading…
Reference in New Issue