From f478db2b2e46c8398aa3009f7a92fab5c3f691c7 Mon Sep 17 00:00:00 2001 From: v2ray Date: Fri, 22 Jan 2016 01:10:25 +0100 Subject: [PATCH] ensure that detour list has not changed --- proxy/vmess/outbound/receiver.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/vmess/outbound/receiver.go b/proxy/vmess/outbound/receiver.go index 591f08274..f0536b55a 100644 --- a/proxy/vmess/outbound/receiver.go +++ b/proxy/vmess/outbound/receiver.go @@ -110,8 +110,10 @@ func (this *ReceiverManager) pickDetour() *Receiver { if rec.Expired() { this.detourAccess.Lock() detourLen := len(this.detours) - this.detours[idx] = this.detours[detourLen-1] - this.detours = this.detours[:detourLen-1] + if detourLen > idx && this.detours[idx].Expired() { + this.detours[idx] = this.detours[detourLen-1] + this.detours = this.detours[:detourLen-1] + } this.detourAccess.Unlock() return nil }