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

Timer (interval) and threads #32

Closed
ibc opened this issue Jun 12, 2019 · 6 comments
Closed

Timer (interval) and threads #32

ibc opened this issue Jun 12, 2019 · 6 comments
Labels
documentation We need documentation question Further information is requested

Comments

@ibc
Copy link

ibc commented Jun 12, 2019

The README clearly says that just a single thread is used, however it does not clarify whether the underlying usrsctp-neat just uses (or can use) a single thread or whether rawrtc-data-channel hides the multi-thread design of usrsctp-neat and exposes a single-thread API to the app.

Also, why does rawrtc-data-channel requires that the app initializes it with a timer_handler callback in which the app must "Start a timer that calls rawrtcdc_timer_tick every interval milliseconds"? Would not make more sense if rawrtc-data-channel knew when it must ask the sctp stack again so it can expose an API (similar to DTLSv1_get_timeout() in OpenSSL) for the app to set a timer at that specific timeout and query rawrtc-data-channel for pending stuff within timer callback?

Probably usrsctp-neat does not expose such an API so it cannot be done. However that would be proper way to go for integrating into a loop, right?.

@lgrahl
Copy link
Member

lgrahl commented Jun 12, 2019

Well, actually, no thread is used. It's driven by whatever thread you call it with. Do you think this section of the FAQ is not clear enough?

Does it create threads?

No. However, there is an issue with the usrsctp dependency which will hopefully be resolved soon.

Last time I checked there was some thread idling (but it doesn't do any harm). Could be that this has been fixed.

Probably usrsctp-neat does not expose such an API so it cannot be done. However that would be proper way to go for integrating into a loop, right?.

Right. But it's not in my hands. 🤷‍♀️

@lgrahl lgrahl added question Further information is requested documentation We need documentation labels Jun 12, 2019
@ibc
Copy link
Author

ibc commented Jun 12, 2019

Yes, it's clear that it does not create threads. I failed to figure out that the timer_handler callback tells the app to run its own timer :)

@ibc
Copy link
Author

ibc commented Jun 12, 2019

BTW: do you consider (or have tested) whether polling rawrtcdc_timer_tick() every 10ms behaves performant?

@saurik
Copy link

saurik commented May 1, 2020

Is there a reason you are using usrsctp-neat instead of the actual upstream usrsctp? The fork you are using is well over 600 commits behind the actual source of this library (which is terrifying from the perspective of a C library that might have random buffer overflows). I noticed this when following the link to see the "issue with the usrsctp dependency", was shocked that it had been open since 2018 with no response given that usrsctp is an actively maintained codebase, and then was like "wait, this isn't the real usrsctp repository :(".

@lgrahl
Copy link
Member

lgrahl commented May 1, 2020

Not sure what you mean. #34 was merged a long time ago. 🙂 I'll update the readme.

@lgrahl
Copy link
Member

lgrahl commented May 1, 2020

The "timer tick" could be more sophisticated but that isn't in my hands. I guess this can be closed then.

@lgrahl lgrahl closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation We need documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants