mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: expose maximumCapacity
This commit is contained in:
parent
9404302778
commit
b10612d685
2 changed files with 10 additions and 9 deletions
|
|
@ -59,7 +59,8 @@ func NewPrivateLightServerAPI(server *LesServer) *PrivateLightServerAPI {
|
||||||
// ServerInfo returns global server parameters
|
// ServerInfo returns global server parameters
|
||||||
func (api *PrivateLightServerAPI) ServerInfo() map[string]interface{} {
|
func (api *PrivateLightServerAPI) ServerInfo() map[string]interface{} {
|
||||||
res := make(map[string]interface{})
|
res := make(map[string]interface{})
|
||||||
res["minimumCapacity"] = uint64(api.server.minCapacity)
|
res["minimumCapacity"] = api.server.minCapacity
|
||||||
|
res["maximumCapacity"] = api.server.maxCapacity
|
||||||
res["freeClientCapacity"] = api.server.freeClientCap
|
res["freeClientCapacity"] = api.server.freeClientCap
|
||||||
res["totalCapacity"], res["totalConnectedCapacity"], res["priorityConnectedCapacity"], res["totalPriorityCapacity"] = api.server.priorityClientPool.capacityInfo()
|
res["totalCapacity"], res["totalConnectedCapacity"], res["priorityConnectedCapacity"], res["totalPriorityCapacity"] = api.server.priorityClientPool.capacityInfo()
|
||||||
return res
|
return res
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,10 @@ type LesServer struct {
|
||||||
|
|
||||||
thcNormal, thcBlockProcessing int // serving thread count for normal operation and block processing mode
|
thcNormal, thcBlockProcessing int // serving thread count for normal operation and block processing mode
|
||||||
|
|
||||||
maxPeers int
|
maxPeers int
|
||||||
minCapacity, freeClientCap uint64
|
minCapacity, maxCapacity, freeClientCap uint64
|
||||||
freeClientPool *freeClientPool
|
freeClientPool *freeClientPool
|
||||||
priorityClientPool *priorityClientPool
|
priorityClientPool *priorityClientPool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLesServer(e *eth.Ethereum, config *eth.Config) (*LesServer, error) {
|
func NewLesServer(e *eth.Ethereum, config *eth.Config) (*LesServer, error) {
|
||||||
|
|
@ -236,11 +236,11 @@ func (s *LesServer) Start(srvr *p2p.Server) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maxCapacity := s.freeClientCap * uint64(s.maxPeers)
|
s.maxCapacity = s.freeClientCap * uint64(s.maxPeers)
|
||||||
if totalRecharge > maxCapacity {
|
if totalRecharge > s.maxCapacity {
|
||||||
maxCapacity = totalRecharge
|
s.maxCapacity = totalRecharge
|
||||||
}
|
}
|
||||||
s.fcManager.SetCapacityLimits(s.freeClientCap, maxCapacity, s.freeClientCap*2)
|
s.fcManager.SetCapacityLimits(s.freeClientCap, s.maxCapacity, s.freeClientCap*2)
|
||||||
poolMetricsLogger := s.csvLogger
|
poolMetricsLogger := s.csvLogger
|
||||||
if !logClientPoolMetrics {
|
if !logClientPoolMetrics {
|
||||||
poolMetricsLogger = nil
|
poolMetricsLogger = nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue