mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Add getSwitchQueues
This commit is contained in:
parent
4666b8f6cd
commit
f57567ea56
3 changed files with 79 additions and 17 deletions
|
@ -90,6 +90,10 @@ func (a *admin) init(c *Core, listenaddr string) {
|
|||
}
|
||||
return admin_info{"switchpeers": switchpeers}, nil
|
||||
})
|
||||
a.addHandler("getSwitchQueues", []string{}, func(in admin_info) (admin_info, error) {
|
||||
queues := a.getData_getSwitchQueues()
|
||||
return admin_info{"switchqueues": queues.asMap()}, nil
|
||||
})
|
||||
a.addHandler("getDHT", []string{}, func(in admin_info) (admin_info, error) {
|
||||
sort := "ip"
|
||||
dht := make(admin_info)
|
||||
|
@ -510,6 +514,22 @@ func (a *admin) getData_getSwitchPeers() []admin_nodeInfo {
|
|||
return peerInfos
|
||||
}
|
||||
|
||||
// getData_getSwitchPeers returns info from Core.switchTable for an admin response.
|
||||
func (a *admin) getData_getSwitchQueues() admin_nodeInfo {
|
||||
var peerInfos admin_nodeInfo
|
||||
switchTable := a.core.switchTable
|
||||
getSwitchQueues := func() {
|
||||
peerInfos = admin_nodeInfo{
|
||||
{"queues_count", len(switchTable.queues.bufs)},
|
||||
{"queues_size", switchTable.queues.size},
|
||||
{"max_queues_count", switchTable.queues.maxbufs},
|
||||
{"max_queues_size", switchTable.queues.maxsize},
|
||||
}
|
||||
}
|
||||
a.core.switchTable.doAdmin(getSwitchQueues)
|
||||
return peerInfos
|
||||
}
|
||||
|
||||
// getData_getDHT returns info from Core.dht for an admin response.
|
||||
func (a *admin) getData_getDHT() []admin_nodeInfo {
|
||||
var infos []admin_nodeInfo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue