소스 검색

ensure that detour list has not changed

v2ray 9 년 전
부모
커밋
f478db2b2e
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      proxy/vmess/outbound/receiver.go

+ 4 - 2
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
 	}