From 18a4134358ff5e83862637a8052b7c9b144b72b3 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Tue, 10 Jan 2017 15:10:12 +0100 Subject: [PATCH] delay close error on blackhole --- proxy/blackhole/blackhole.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy/blackhole/blackhole.go b/proxy/blackhole/blackhole.go index 432e4337d..59766dbdc 100644 --- a/proxy/blackhole/blackhole.go +++ b/proxy/blackhole/blackhole.go @@ -2,6 +2,8 @@ package blackhole import ( + "time" + "v2ray.com/core/app" v2net "v2ray.com/core/common/net" "v2ray.com/core/proxy" @@ -31,6 +33,9 @@ func (v *Handler) Dispatch(destination v2net.Destination, ray ray.OutboundRay) { v.response.WriteTo(ray.OutboundOutput()) ray.OutboundOutput().Close() + // CloseError() will immediately close the connection. + // Sleep a little here to make sure the response is sent to client. + time.Sleep(time.Millisecond * 500) ray.OutboundInput().CloseError() }