Skip to content

Conversation

@Asurar0
Copy link
Contributor

@Asurar0 Asurar0 commented Sep 9, 2024

What

Closes: #176

This PR implements the following changes:

  • If the maximum inbound connection semaphore reach its limit, inbound_server fn will open a tokio task to check if the node wanted to ping us. If it is the case we respond, otherwise drop the connection.
  • Added some documentation to the inbound_server fn.

@github-actions github-actions bot added the A-p2p Area: Related to P2P. label Sep 9, 2024
Copy link
Member

@Boog900 Boog900 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

.instrument(Span::current())
);

task.await.expect("A tokio task responsible for handling ping requests panicked!");
Copy link
Member

Choose a reason for hiding this comment

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

By awaiting the task here we block the inbound server from processing other connections.

I would recommend spawning these tasks on a JoinSet and checking the length to limit concurrent pings instead of using a semaphore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in latest commit.

@Asurar0 Asurar0 requested a review from Boog900 September 9, 2024 18:07
@Asurar0 Asurar0 requested a review from Boog900 September 9, 2024 19:36
@Asurar0 Asurar0 force-pushed the handle_incoming_ping branch from 74436e6 to ce2b990 Compare September 9, 2024 21:16
- If the maximum inbound connection semaphore reach its limit, `inbound_server` fn will
open a tokio task to check if the node wanted to ping us. If it is the case we respond, otherwise
drop the connection.
- Added some documentation to the `inbound_server` fn.
@Asurar0 Asurar0 force-pushed the handle_incoming_ping branch from ce2b990 to 29faf34 Compare September 9, 2024 21:47
@Asurar0 Asurar0 closed this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-p2p Area: Related to P2P.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle inbound connection pings.

2 participants