paullouisageneau / libjuice

JUICE is a UDP Interactive Connectivity Establishment library
Mozilla Public License 2.0
426 stars 80 forks source link

Allow multiplexing multiple connections over a single UDP port #144

Closed paullouisageneau closed 2 years ago

paullouisageneau commented 2 years ago

See https://github.com/paullouisageneau/libdatachannel/issues/555

jordo commented 2 years ago

Is there anything I can do to help with this? The implementation via golang here seems relatively straightforward, but I would be unsure how best way to work a mux into libjuice design

paullouisageneau commented 2 years ago

Is there anything I can do to help with this? The implementation via golang here seems relatively straightforward, but I would be unsure how best way to work a mux into libjuice design

Well, funding is really welcome if you have the means to be a sponsor :smile:

This is indeed tricky to implement here as libjuice is designed on the assumption that each agent manages its own socket. Additionally, the existing behavior must be kept when the option is disabled.

I'll think about it, but for now I think the best way is to move socket creation and polling from agents to a single-threaded external mux, and introduce an alternative implementation with the multiplexed behavior. This requires rearchitecturing but allows for a simpler and manageable threading model.

stazio commented 2 years ago

Super excited to see this in the works. :rocket: :rocket: :rocket:

jordo commented 2 years ago

🚀🚀🚀

paullouisageneau commented 2 years ago

Implementation in https://github.com/paullouisageneau/libjuice/pull/148 is not completely finished, but it works well as a proof of concept. The PR in libdatachannel to add UDP multiplexing as an option is here: https://github.com/paullouisageneau/libdatachannel/pull/570

paullouisageneau commented 2 years ago

I just merged https://github.com/paullouisageneau/libjuice/pull/148 :rocket: