Skip to content

Conversation

@mempirate
Copy link
Contributor

@mempirate mempirate commented Nov 17, 2025

To Do

  • Implement higher layer metrics/stats consumers
  • Implement Linux support for getsockopts

Stats for other transports will be added in follow-up

@mempirate mempirate marked this pull request as ready for review November 18, 2025 10:23
Copy link
Contributor

@merklefruit merklefruit left a comment

Choose a reason for hiding this comment

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

smol nits

pub(crate) transport: Arc<RwLock<Arc<S>>>,
}

// Manual clone implementation needed here because `S` is n`.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo?

where
Io: AsyncRead + AsyncWrite + PeerAddress<A> + Unpin,
A: Address,
S: for<'a> TryFrom<&'a Io, Error: Debug>,
Copy link
Contributor

Choose a reason for hiding this comment

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

nice :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This took me a while ngl

Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

First pass, mostly readability / clarity!

Comment on lines +34 to +35
type ConnectionCtl<Io, S, A> =
ConnectionState<Framed<MeteredIo<Io, S, A>, reqrep::Codec>, ExponentialBackoff, A>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you keep generics a little bit descriptive? Like Stats and Addr, otherwise looks a bit like the alphabet.

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 usually avoid doing that because then they become indistinguishable from concrete type implementations

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Anyway, I think C# got it right since a lot of years with the T* naming convention. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/identifier-names#type-parameter-naming-guidelines. I've also seen it a lot in TypeScript and I think it's great.

/// The interval at which the stats should be refreshed.
refresh_interval: Duration,

_marker: PhantomData<A>,
Copy link
Contributor

Choose a reason for hiding this comment

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

The marker is not needed here, A is already captured by Io.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still needs to be actually referenced in one of the fields, I can't remove this.

pub(crate) struct SocketState<S> {
/// The socket stats.
pub(crate) stats: Arc<SocketStats<ReqStats>>,
pub(crate) transport: Arc<RwLock<Arc<S>>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit doubtful of the Arc wrapping RwLock wrapping Arc... It feels a bit of an anti pattern

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why it's necessary? Maybe with a short comment here even

@mempirate mempirate requested a review from thedevbirb November 18, 2025 11:43
@mempirate mempirate requested a review from Karrq November 18, 2025 11:43
Co-authored-by: Karrq <franci.dainese@gmail.com>
Copy link
Contributor

@merklefruit merklefruit left a comment

Choose a reason for hiding this comment

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

🚢

@thedevbirb thedevbirb merged commit 2c68093 into main Nov 18, 2025
14 checks passed
@thedevbirb thedevbirb deleted the feat/tcp-stats branch November 18, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants