mirror of
https://gitee.com/willfree/mlsr.git
synced 2026-06-06 19:49:27 +08:00
名称前缀表及RTPE中的map必须初始化分配内存后才能使用
This commit is contained in:
@@ -6,12 +6,28 @@ require (
|
||||
//github.com/rakanalh/scheduler v0.1
|
||||
github.com/go-co-op/gocron v1.13.0
|
||||
github.com/liyue201/gostl v1.0.1
|
||||
github.com/smartystreets/goconvey v1.7.2 // indirect
|
||||
github.com/tidwall/btree v1.2.1 // indirect
|
||||
github.com/tidwall/buntdb v1.2.9
|
||||
github.com/tidwall/gjson v1.14.0 // indirect
|
||||
gopkg.in/ini.v1 v1.62.0
|
||||
minlib v0.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||
github.com/mutecomm/go-sqlcipher/v4 v4.4.2 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/smartystreets/goconvey v1.7.2 // indirect
|
||||
github.com/tidwall/btree v1.2.1 // indirect
|
||||
github.com/tidwall/gjson v1.14.0 // indirect
|
||||
github.com/tidwall/grect v0.1.4 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tidwall/rtred v0.1.2 // indirect
|
||||
github.com/tidwall/tinyqueue v0.1.1 // indirect
|
||||
github.com/tylertreat/BoomFilters v0.0.0-20210315201527-1a82519a3e43 // indirect
|
||||
github.com/zeebo/xxh3 v1.0.1 // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect
|
||||
)
|
||||
|
||||
replace minlib v0.0.0 => ../minlib
|
||||
|
||||
@@ -78,4 +78,3 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -50,6 +50,8 @@ type NamePrefixTable struct {
|
||||
func (t *NamePrefixTable) Init(ownRouterName *component.Identifier,
|
||||
routingTable *RoutingTable, afterRoutingChangeSignal *utils.Signal,
|
||||
afterLsdbModifiedSignal *utils.Signal) {
|
||||
// 初始化数据结构
|
||||
t.m_rtpool = make(map[string]*RoutingTablePoolEntry)
|
||||
// 赋值变量
|
||||
t.m_ownRouterName = ownRouterName
|
||||
t.m_routingTable = routingTable
|
||||
|
||||
@@ -53,6 +53,8 @@ func (pe *RoutingTablePoolEntry) ToString() string {
|
||||
func (pe *RoutingTablePoolEntry) Init(dest *component.Identifier) {
|
||||
pe.m_destination = dest
|
||||
pe.m_useCount = 1
|
||||
// map 初始化
|
||||
pe.NamePrefixTableEntries = make(map[string]*NamePrefixTableEntry)
|
||||
}
|
||||
|
||||
//
|
||||
@@ -66,6 +68,8 @@ func (pe *RoutingTablePoolEntry) InitRTE(rte *RoutingTableEntry, useCount uint64
|
||||
pe.m_destination = rte.m_destination
|
||||
pe.nextHops = rte.GetNextHops()
|
||||
pe.m_useCount = useCount
|
||||
// map 初始化
|
||||
pe.NamePrefixTableEntries = make(map[string]*NamePrefixTableEntry)
|
||||
}
|
||||
|
||||
//
|
||||
@@ -78,6 +82,8 @@ func (pe *RoutingTablePoolEntry) InitRTE(rte *RoutingTableEntry, useCount uint64
|
||||
func (pe *RoutingTablePoolEntry) InitDest(dest *component.Identifier, useCount uint64) {
|
||||
pe.m_destination = dest
|
||||
pe.m_useCount = useCount
|
||||
// map 初始化
|
||||
pe.NamePrefixTableEntries = make(map[string]*NamePrefixTableEntry)
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user