1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

ensure that detour list has not changed

This commit is contained in:
v2ray 2016-01-22 01:10:25 +01:00
parent 2c03641f74
commit f478db2b2e

View File

@ -110,8 +110,10 @@ func (this *ReceiverManager) pickDetour() *Receiver {
if rec.Expired() { if rec.Expired() {
this.detourAccess.Lock() this.detourAccess.Lock()
detourLen := len(this.detours) detourLen := len(this.detours)
if detourLen > idx && this.detours[idx].Expired() {
this.detours[idx] = this.detours[detourLen-1] this.detours[idx] = this.detours[detourLen-1]
this.detours = this.detours[:detourLen-1] this.detours = this.detours[:detourLen-1]
}
this.detourAccess.Unlock() this.detourAccess.Unlock()
return nil return nil
} }