|
|
@ -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
|
|
|
|
}
|
|
|
|
}
|
|
|
|