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

Expose underlying transport connection stat where available #71

Merged
merged 2 commits into from Feb 17, 2021

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Feb 4, 2021

depends on libp2p/go-libp2p-core#175

TODO

  • Update deps.

Copy link
Contributor

@aarshkshah1992 aarshkshah1992 left a comment

Choose a reason for hiding this comment

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

Lgtm. Just need to release & update deps & then fix conflicts.

@vyzo vyzo merged commit a6f4445 into master Feb 17, 2021
@vyzo vyzo deleted the feat/conn-stat branch February 17, 2021 09:37
@@ -66,6 +66,11 @@ func (u *Upgrader) UpgradeInbound(ctx context.Context, t transport.Transport, ma
}

func (u *Upgrader) upgrade(ctx context.Context, t transport.Transport, maconn manet.Conn, p peer.ID, dir network.Direction) (transport.CapableConn, error) {
var stat network.Stat
if cs, ok := maconn.(network.ConnStat); ok {
stat = cs.Stat()
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if we could just call this on-demand. Not critical but the results from Stat may not always be constant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be nice indeed, but right now it wouldn't buy us much the way the swarm treats the stat object. That could change too of course if we want to expose dynamic stat information.

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.

None yet

3 participants