better handling error from Pipe()

This commit is contained in:
Darien Raymond committed 2016-11-22 00:17:49 +01:00
1 parent a9946a2dc1
commit 6804d8f73a
9 files changed
+51 -36

No files matched your search

+2 -4
View File
@@ -192,8 +192,7 @@ func (this *VMessInboundHandler) HandleConnection(connection internet.Connection
} else {
requestReader = v2io.NewAdaptiveReader(bodyReader)
}
err := v2io.Pipe(requestReader, input)
if err != io.EOF {
if err := v2io.PipeUntilEOF(requestReader, input); err != nil {
connection.SetReusable(false)
}
@@ -229,8 +228,7 @@ func (this *VMessInboundHandler) HandleConnection(connection internet.Connection
writer.SetCached(false)
err = v2io.Pipe(output, v2writer)
if err != io.EOF {
if err := v2io.PipeUntilEOF(output, v2writer); err != nil {
connection.SetReusable(false)
}
+2 -5
View File
@@ -1,7 +1,6 @@
package outbound
import (
"io"
"sync"
"v2ray.com/core/app"
@@ -107,8 +106,7 @@ func (this *VMessOutboundHandler) handleRequest(session *encoding.ClientSession,
}
writer.SetCached(false)
err := v2io.Pipe(input, streamWriter)
if err != io.EOF {
if err := v2io.PipeUntilEOF(input, streamWriter); err != nil {
conn.SetReusable(false)
}
@@ -150,8 +148,7 @@ func (this *VMessOutboundHandler) handleResponse(session *encoding.ClientSession
bodyReader = v2io.NewAdaptiveReader(decryptReader)
}
err = v2io.Pipe(bodyReader, output)
if err != io.EOF {
if err := v2io.PipeUntilEOF(bodyReader, output); err != nil {
conn.SetReusable(false)
}