mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-21 07:07:08 +00:00
close outbound connections when context is done
This commit is contained in:
12 files changed
+45
-28
No files matched your search
@@ -65,7 +65,14 @@ func NewHandler(ctx context.Context, config *proxyman.OutboundHandlerConfig) (*H
|
||||
|
||||
func (h *Handler) Dispatch(ctx context.Context, outboundRay ray.OutboundRay) {
|
||||
ctx = proxy.ContextWithDialer(ctx, h)
|
||||
h.proxy.Process(ctx, outboundRay)
|
||||
err := h.proxy.Process(ctx, outboundRay)
|
||||
// Ensure outbound ray is properly closed.
|
||||
if err != nil {
|
||||
outboundRay.OutboundOutput().CloseError()
|
||||
} else {
|
||||
outboundRay.OutboundOutput().Close()
|
||||
}
|
||||
outboundRay.OutboundInput().CloseError()
|
||||
}
|
||||
|
||||
func (h *Handler) Dial(ctx context.Context, dest v2net.Destination) (internet.Connection, error) {
|
||||
|
||||
Reference in new issue
Block a user