Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(s2n-quic-dc): reduce the number of peer_addr calls #2401

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Dec 4, 2024

Description of changes:

The current TCP acceptor calls peer_addr quite a few times, especially after events were added. This change, instead, caches the value and uses that everywhere.

Call-outs:

I noticed that our fmt::Debug impls were calling peer_addr().unwrap(), which isn't good. So I refactored those to not panic.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Collaborator

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

I wonder if we should cache the addresses and have infallible peer/local_addr functions (for use in Debug etc).

@camshaft
Copy link
Contributor Author

camshaft commented Dec 4, 2024

I wonder if we should cache the addresses and have infallible peer/local_addr functions (for use in Debug etc).

We do, we just have some checks in place to emulate what unix sockets do when they're closed.

@camshaft camshaft merged commit 513212c into main Dec 4, 2024
129 of 130 checks passed
@camshaft camshaft deleted the camshaft/dc-peer-addr branch December 4, 2024 18:34
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.

2 participants