mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-19 23:03:08 +00:00
always recreate buffer for ich in user
This commit is contained in:
1 parent
795681c288
commit
c61cd2cf8f
1 file changed
+5
-4
@@ -54,9 +54,7 @@ func (this *InboundDetourHandlerDynamic) refresh() error {
|
|||||||
|
|
||||||
ichCount := this.config.Allocation.Concurrency
|
ichCount := this.config.Allocation.Concurrency
|
||||||
// TODO: check ichCount
|
// TODO: check ichCount
|
||||||
if this.ichInUse == nil {
|
this.ichInUse = make([]*InboundConnectionHandlerWithPort, ichCount)
|
||||||
this.ichInUse = make([]*InboundConnectionHandlerWithPort, ichCount)
|
|
||||||
}
|
|
||||||
for idx, _ := range this.ichInUse {
|
for idx, _ := range this.ichInUse {
|
||||||
port := this.pickUnusedPort()
|
port := this.pickUnusedPort()
|
||||||
ich, err := proxyrepo.CreateInboundConnectionHandler(this.config.Protocol, this.space, this.config.Settings)
|
ich, err := proxyrepo.CreateInboundConnectionHandler(this.config.Protocol, this.space, this.config.Settings)
|
||||||
@@ -98,7 +96,10 @@ func (this *InboundDetourHandlerDynamic) GetConnectionHandler() (proxy.InboundCo
|
|||||||
this.RLock()
|
this.RLock()
|
||||||
defer this.RUnlock()
|
defer this.RUnlock()
|
||||||
ich := this.ichInUse[dice.Roll(len(this.ichInUse))]
|
ich := this.ichInUse[dice.Roll(len(this.ichInUse))]
|
||||||
until := (time.Now().Unix() - this.lastRefresh.Unix()) / 60 / 1000
|
until := this.config.Allocation.Refresh - int((time.Now().Unix()-this.lastRefresh.Unix())/60/1000)
|
||||||
|
if until < 0 {
|
||||||
|
until = 0
|
||||||
|
}
|
||||||
return ich.handler, int(until)
|
return ich.handler, int(until)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user