mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
delay close error on blackhole
This commit is contained in:
parent
8df8fad293
commit
18a4134358
@ -2,6 +2,8 @@
|
|||||||
package blackhole
|
package blackhole
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"v2ray.com/core/app"
|
"v2ray.com/core/app"
|
||||||
v2net "v2ray.com/core/common/net"
|
v2net "v2ray.com/core/common/net"
|
||||||
"v2ray.com/core/proxy"
|
"v2ray.com/core/proxy"
|
||||||
@ -31,6 +33,9 @@ func (v *Handler) Dispatch(destination v2net.Destination, ray ray.OutboundRay) {
|
|||||||
v.response.WriteTo(ray.OutboundOutput())
|
v.response.WriteTo(ray.OutboundOutput())
|
||||||
ray.OutboundOutput().Close()
|
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()
|
ray.OutboundInput().CloseError()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user