1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-02-17 05:35:20 -05:00

refine error handling in retry logic

This commit is contained in:
Darien Raymond
2017-02-10 11:41:50 +01:00
parent 51745e772c
commit 5e7fb6d0dd
10 changed files with 33 additions and 35 deletions

View File

@@ -66,10 +66,13 @@ func NewHandler(ctx context.Context, config *proxyman.OutboundHandlerConfig) (*H
func (h *Handler) Dispatch(ctx context.Context, outboundRay ray.OutboundRay) {
err := h.proxy.Process(ctx, outboundRay, h)
// Ensure outbound ray is properly closed.
if err != nil && errors.Cause(err) != io.EOF {
outboundRay.OutboundOutput().CloseError()
} else {
outboundRay.OutboundOutput().Close()
if err != nil {
log.Warning("Proxyman|OutboundHandler: Failed to process outbound traffic.")
if errors.Cause(err) != io.EOF {
outboundRay.OutboundOutput().CloseError()
} else {
outboundRay.OutboundOutput().Close()
}
}
outboundRay.OutboundInput().CloseError()
}