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

Use a single socket for accept and connect #1607

Open
Frando opened this issue Jan 20, 2023 · 7 comments
Open

Use a single socket for accept and connect #1607

Frando opened this issue Jan 20, 2023 · 7 comments

Comments

@Frando
Copy link

Frando commented Jan 20, 2023

Problem:

I'd like to use a s2n_quic socket both for accepting inbound connections and initiating outbound connections.

We're investigating using s2n_quic in a peer-to-peer scenario. There, it is very common for an endpoint to both act as a server (accepting incoming connections) and as a client (initiating outbound connections). When connecting to many peers and holding these connections for a longer time, it saves resources and ports to do it all over a single socket. It also makes holepunching easier if having a single socket for many connections.

If I read things correctly, QUIC as a protocol supports this just fine. Other implementations also support this, e.g. quinn::Endpoint has both connec and accept methods.

Solution:

Provide a connect method on Server or expose an Endpoint that can act both as a server (accept) and a client (connect).

  • Does this change what s2n-quic sends over the wire? No
  • Does this change any public APIs? --> Addition only

Requirements / Acceptance Criteria:

Out of scope:

@camshaft
Copy link
Contributor

I agree that having a p2p capability would be useful. We're going to be investigating this use case in the next few months.

dignifiedquire added a commit to n0-computer/sendme-legacy that referenced this issue Feb 6, 2023
Tests are failing because of port reuse issues and shutdown, should be
fixed with the other PRs merged

Needed to allow work on hole punching in the short term.

Ref #111 

See

- aws/s2n-quic#1607
- aws/s2n-quic#1608
@cavemanloverboy
Copy link

I agree that having a p2p capability would be useful. We're going to be investigating this use case in the next few months.

any progress?

@camshaft
Copy link
Contributor

camshaft commented Jul 7, 2023

Unfortunately no updates on this

@cavemanloverboy
Copy link

Unfortunately no updates on this

if you can provide some resources and an outline on what needs to be done (i.e. checklist), I could try to write something up over the next few weekends.

@camshaft
Copy link
Contributor

That would be great! I will try to get a list of things together by Friday.

Initially, I think the biggest issue is going to be figuring out how to account for the use of Config::ENDPOINT_TYPE everywhere, since that's a const. The nice thing about it right now is all of the code gated behind that is compiled out for clients and servers.

@cavemanloverboy
Copy link

That would be great! I will try to get a list of things together by Friday.

Initially, I think the biggest issue is going to be figuring out how to account for the use of Config::ENDPOINT_TYPE everywhere, since that's a const. The nice thing about it right now is all of the code gated behind that is compiled out for clients and servers.

lmk if you've made any progress on making a list of resources/requirements.

@camshaft
Copy link
Contributor

camshaft commented Aug 1, 2023

I haven't had a chance unfortunately. Looking at it a bit more, this is going to be a pretty large change that touches quite a bit of the codebase and I'm still not totally sure what it would look like at the end of the refactor. We're currently working on a few other refactors for performance improvements and my worry is we end up getting into complicated merge conflicts.

With that being said, I do want to get this feature addressed. But, due to priorities, it likely won't be at least a few months until we can get the time to actually define how it'll look in practice.

rklaehn pushed a commit to n0-computer/iroh-blobs that referenced this issue Oct 22, 2024
Tests are failing because of port reuse issues and shutdown, should be
fixed with the other PRs merged

Needed to allow work on hole punching in the short term.

Ref #111 

See

- aws/s2n-quic#1607
- aws/s2n-quic#1608
rklaehn pushed a commit to n0-computer/iroh-blobs that referenced this issue Oct 22, 2024
Tests are failing because of port reuse issues and shutdown, should be
fixed with the other PRs merged

Needed to allow work on hole punching in the short term.

Ref #111 

See

- aws/s2n-quic#1607
- aws/s2n-quic#1608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants