1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-22 13:39:11 -04:00

able to close ray stream with error

This commit is contained in:
Darien Raymond
2017-01-10 14:22:42 +01:00
parent 1cf9cd5d78
commit 72992c7478
15 changed files with 57 additions and 61 deletions

View File

@@ -172,8 +172,6 @@ func (v *DokodemoDoor) HandleTCPConnection(conn internet.Connection) {
Destination: dest,
Inbound: v.meta,
})
output := ray.InboundOutput()
defer output.ForceClose()
reader := v2net.NewTimeOutReader(v.config.Timeout, conn)
@@ -191,11 +189,9 @@ func (v *DokodemoDoor) HandleTCPConnection(conn internet.Connection) {
})
responseDone := signal.ExecuteAsync(func() error {
defer output.ForceClose()
v2writer := buf.NewWriter(conn)
if err := buf.PipeUntilEOF(output, v2writer); err != nil {
if err := buf.PipeUntilEOF(ray.InboundOutput(), v2writer); err != nil {
log.Info("Dokodemo: Failed to transport all TCP response: ", err)
return err
}
@@ -203,6 +199,8 @@ func (v *DokodemoDoor) HandleTCPConnection(conn internet.Connection) {
})
if err := signal.ErrorOrFinish2(requestDone, responseDone); err != nil {
ray.InboundInput().CloseError()
ray.InboundOutput().CloseError()
log.Info("Dokodemo: Connection ends with ", err)
}
}