Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

return a ConnectionStat instead of a Stat for the Conn #224

Closed
wants to merge 1 commit into from

Conversation

marten-seemann
Copy link
Contributor

@marten-seemann marten-seemann commented Dec 10, 2021

This allows us to expose the number of streams that are currently open on a connection, which will allow us to prioritize killing of connections with many streams in the connection manager.

Copy link
Contributor

@vyzo vyzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should call it ConnStat as we don't spell it fully anywhere; other than that LGTM.

@@ -96,7 +96,14 @@ func (r Reachability) String() string {
return str[r]
}

// Stat stores metadata pertaining to a given Stream/Conn.
// ConnectionStat stores metadata pertaining to a given Conn.
type ConnectionStat struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it ConnStat for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to, but ConnStat is already the interface:

// ConnStat is an interface mixin for connection types that provide connection statistics.
type ConnStat interface {
// Stat stores metadata pertaining to this conn.
Stat() Stat
}

@github-actions
Copy link

gocompat says:

Branch 'master' set up to track remote branch 'master' from 'origin'.
"github.com/libp2p/go-libp2p-core/network".ConnStat InterfaceChanged
"github.com/libp2p/go-libp2p-core/network".Conn InterfaceChanged

@vyzo
Copy link
Contributor

vyzo commented Dec 10, 2021 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants