1.只留下BlockingQueueCache

2.为了避免循环引用,重新整理package结构
This commit is contained in:
dmy@lab
2016-01-11 21:29:48 +08:00
parent b284b401dc
commit 8599c87f0c
7 changed files with 57 additions and 79 deletions

View File

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