1.只留下BlockingQueueCache
2.为了避免循环引用,重新整理package结构
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"container/list"
|
||||
"fmt"
|
||||
"github.com/TransX/log"
|
||||
"github.com/TransX/model"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -40,12 +41,25 @@ func (this *TunnelStatusManager) unregister(t interface{}) {
|
||||
this.mux.Lock()
|
||||
defer this.mux.Unlock()
|
||||
l := this.tunnelList
|
||||
log.Debug("%d tunnels before remove.", this.tunnelList.Len())
|
||||
n := 0
|
||||
nl := new(list.List)
|
||||
for e := l.Front(); e != nil; e = e.Next() {
|
||||
if e == t {
|
||||
l.Remove(e)
|
||||
break
|
||||
if e.Value != t {
|
||||
// log.Debug("Found")
|
||||
// l.Remove(e)
|
||||
// break
|
||||
n++
|
||||
nl.PushBack(e.Value)
|
||||
}
|
||||
|
||||
}
|
||||
if n == this.tunnelList.Len() {
|
||||
m := t.(*model.Tunnel)
|
||||
log.Debug("check tunntel %s", m.GetID())
|
||||
}
|
||||
this.tunnelList = *nl
|
||||
log.Debug("%d tunnels after remove.", this.tunnelList.Len())
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user