mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-10 15:30:34 +03:00
Move responsibility for configuring max queue size into switch
This commit is contained in:
parent
fc9a1c6c31
commit
aa0770546e
@ -152,14 +152,6 @@ func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) (*config.NodeState,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.config.Mutex.RLock()
|
|
||||||
if c.config.Current.SwitchOptions.MaxTotalQueueSize >= SwitchQueueTotalMinSize {
|
|
||||||
phony.Block(&c.switchTable, func() {
|
|
||||||
c.switchTable.queues.totalMaxSize = c.config.Current.SwitchOptions.MaxTotalQueueSize
|
|
||||||
})
|
|
||||||
}
|
|
||||||
c.config.Mutex.RUnlock()
|
|
||||||
|
|
||||||
if err := c.switchTable.start(); err != nil {
|
if err := c.switchTable.start(); err != nil {
|
||||||
c.log.Errorln("Failed to start switch")
|
c.log.Errorln("Failed to start switch")
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -193,7 +193,13 @@ func (t *switchTable) init(core *Core) {
|
|||||||
t.table.Store(lookupTable{})
|
t.table.Store(lookupTable{})
|
||||||
t.drop = make(map[crypto.SigPubKey]int64)
|
t.drop = make(map[crypto.SigPubKey]int64)
|
||||||
phony.Block(t, func() {
|
phony.Block(t, func() {
|
||||||
t.queues.totalMaxSize = SwitchQueueTotalMinSize
|
core.config.Mutex.RLock()
|
||||||
|
if core.config.Current.SwitchOptions.MaxTotalQueueSize > SwitchQueueTotalMinSize {
|
||||||
|
t.queues.totalMaxSize = core.config.Current.SwitchOptions.MaxTotalQueueSize
|
||||||
|
} else {
|
||||||
|
t.queues.totalMaxSize = SwitchQueueTotalMinSize
|
||||||
|
}
|
||||||
|
core.config.Mutex.RUnlock()
|
||||||
t.queues.bufs = make(map[string]switch_buffer)
|
t.queues.bufs = make(map[string]switch_buffer)
|
||||||
t.idle = make(map[switchPort]time.Time)
|
t.idle = make(map[switchPort]time.Time)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user