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

Are more than one protocol without threads possible? #30

Open
berndpetrovitsch opened this issue Jul 3, 2016 · 1 comment
Open

Are more than one protocol without threads possible? #30

berndpetrovitsch opened this issue Jul 3, 2016 · 1 comment

Comments

@berndpetrovitsch
Copy link

Is it (somewhat easily) possible to have different callbacks registered on different ports (e.g.because the implement different protocols) without threads?
And for this, one needs to (also) hook some buffer transfer logic as the daemon mustn't block.

So the basic idea is:

  • register various callbacks to various (different) ports
  • the callbacks are called if data is available. the callback functions buffer the data and handle it, if enough data is here (e.a. a complete request).
  • the response is constructed (non-blocking) and stored in some buffer (and is gradually transmitted).

Using threads just adds the complexity for internal explicit synchronization ....

@wolkykim
Copy link
Owner

wolkykim commented Jul 4, 2016

As you probably know already, libasyncd listens on single port per server. So for now, it probably needs multiple servers to listen on multiple ports. So my answer to the question is no.

I guess you'd like to run different type of requests on different ports but handles them all from single thread. If the type of requests on various ports can be determined from the input data rather than tcp port number, I guess you could consider port forwarding technique.

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

No branches or pull requests

2 participants