mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
delay close of existing connections
This commit is contained in:
parent
f7d3f22d84
commit
03ee9c7e3d
@ -97,6 +97,7 @@ func (this *InboundDetourHandlerDynamic) refresh() error {
|
|||||||
for _, ich := range this.ichInUse {
|
for _, ich := range this.ichInUse {
|
||||||
ich.port = this.pickUnusedPort()
|
ich.port = this.pickUnusedPort()
|
||||||
err := retry.Timed(100 /* times */, 100 /* ms */).On(func() error {
|
err := retry.Timed(100 /* times */, 100 /* ms */).On(func() error {
|
||||||
|
ich.handler.Close()
|
||||||
err := ich.handler.Listen(ich.port)
|
err := ich.handler.Listen(ich.port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Point: Failed to start inbound detour on port ", ich.port, ": ", err)
|
log.Error("Point: Failed to start inbound detour on port ", ich.port, ": ", err)
|
||||||
@ -121,14 +122,6 @@ func (this *InboundDetourHandlerDynamic) Start() error {
|
|||||||
go func() {
|
go func() {
|
||||||
for range time.Tick(time.Duration(this.config.Allocation.Refresh) * time.Minute) {
|
for range time.Tick(time.Duration(this.config.Allocation.Refresh) * time.Minute) {
|
||||||
this.refresh()
|
this.refresh()
|
||||||
|
|
||||||
<-time.After(time.Minute)
|
|
||||||
for _, ich := range this.ich2Recycle {
|
|
||||||
if ich != nil {
|
|
||||||
ich.handler.Close()
|
|
||||||
delete(this.portsInUse, ich.port)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user