1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

GO-2828: fix comments

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
AnastasiaShemyakinskaya 2024-10-30 14:13:35 +01:00
parent f85006c0b8
commit c0f3ea733a
No known key found for this signature in database
GPG key ID: CCD60ED83B103281
3 changed files with 6 additions and 7 deletions

View file

@ -334,9 +334,12 @@ func (p *peer) Close() (err error) {
func (p *peer) ProvideStat() *Stat {
protoVersion, _ := CtxProtoVersion(p.Context())
p.mu.Lock()
subConnectionsCount := len(p.active)
p.mu.Unlock()
return &Stat{
PeerId: p.id,
SubConnections: len(p.subConnRelease),
SubConnections: subConnectionsCount,
Created: p.created,
Version: protoVersion,
}

View file

@ -142,10 +142,6 @@ func (p *pool) pick(ctx context.Context, source ocache.OCache, id string) (peer.
return nil, fmt.Errorf("failed to pick connection with peer: peer not found")
}
func (p *pool) AddStatProvider() {
p.statService.AddProvider(p)
}
func (p *pool) ProvideStat() any {
peerStats := make([]*peer.Stat, 0)
p.outgoing.ForEach(func(v ocache.Object) (isContinue bool) {

View file

@ -69,8 +69,8 @@ func (p *poolService) Init(a *app.App) (err error) {
if !ok {
comp = debugstat.NewNoOp()
}
p.pool.statService = comp
p.pool.AddStatProvider()
p.statService = comp
p.statService.AddProvider(p)
return nil
}