-
Notifications
You must be signed in to change notification settings - Fork 281
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
Initial version of tox_loop, the low-latency API #131
Conversation
142fa4e
to
5563cc0
Compare
Review status: 0 of 8 files reviewed at latest revision, 7 unresolved discussions, some commit checks failed. auto_tests/tox_loop_test.c, line 4 at r1 (raw file):
Sort headers. Reverse the blocks (system headers last). other/apidsl/tox.in.h, line 815 at r1 (raw file):
Capitalise and use punctuation. Also use other/apidsl/tox.in.h, line 823 at r1 (raw file):
Add empty lines between each declaration in namespace loop. other/apidsl/tox.in.h, line 834 at r1 (raw file):
This sentence does not parse. Please revise all the comments in your additions. Take a look at other events for inspiration. toxcore/TCP_connection.c, line 1442 at r1 (raw file):
Empty line before definition. toxcore/TCP_connection.c, line 1448 at r1 (raw file):
Braces and newlines. Add to all the single line ifs you have. toxcore/tox.c, line 519 at r1 (raw file):
Where does this arbitrary limit of 20 come from? Comments from Reviewable |
Reviewed 1 of 8 files at r1. auto_tests/tox_loop_test.c, line 43 at r1 (raw file):
Comments from Reviewable |
5563cc0
to
50fd880
Compare
@cleverca22 could explain why this PR is needed and why we should accept it? I know there was an IRC conversation, but it's nice to have this explained for the record and I didn't follow the conversation that much. |
50fd880
to
6c1de36
Compare
I gave it just a quick glance. I will review this more thoughtfully later. |
if tox_iterate_interval() returns 50ms, and you only ever run tox_iterate() every 50ms, then it cant process received packets any more often this leads to things like 50ms ping to a toxcore node on the same LAN, and 200ms pings to a toxcore node that only gets under ~57ms outside of tox letting toxcore block on a select() call over all network FD's allows it to instantly respond to any incoming packets |
fcac40d
to
943b8b5
Compare
Review status: 1 of 6 files reviewed at latest revision, 11 unresolved discussions. other/apidsl/tox.in.h, line 823 at r1 (raw file):
|
943b8b5
to
6b140a8
Compare
updated |
6b140a8
to
151618e
Compare
Review status: 1 of 6 files reviewed at latest revision, 11 unresolved discussions. auto_tests/tox_loop_test.c, line 4 at r1 (raw file):
|
151618e
to
8a8b06a
Compare
Review status: 1 of 6 files reviewed at latest revision, 11 unresolved discussions. other/apidsl/tox.in.h, line 823 at r1 (raw file):
|
Review status: 1 of 6 files reviewed at latest revision, 22 unresolved discussions. auto_tests/tox_loop_test.c, line 64 at r3 (raw file):
Perhaps replace the double empty lines with a single empty line plus a comment what the block of code does. auto_tests/tox_loop_test.c, line 108 at r3 (raw file):
"Tox loop"? other/apidsl/tox.in.h, line 815 at r3 (raw file):
"automatically". But this comment doesn't really explain what the function does. Running a function automatically could also just mean that it invokes it, and then sleeps until loop.stop(). other/apidsl/tox.in.h, line 823 at r3 (raw file):
Remove empty line (again). toxcore/tox.c, line 484 at r3 (raw file):
This comment is next to useless. toxcore/tox.c, line 491 at r3 (raw file):
Add newline before comment. toxcore/tox.c, line 492 at r3 (raw file):
It gathers a list of every FD that we expect network activity on. Whether the client code waits on it or polls is not up to this function. toxcore/tox.c, line 494 at r3 (raw file):
I'd prefer you just require (and document the requirement) that sockets is an array of length toxcore/tox.c, line 545 at r3 (raw file):
Can we call this at the beginning of the loop, then immediately call tox_iterate (so tox_iterate will be called before select), and call the stop cb at the end of the loop? toxcore/tox.c, line 564 at r3 (raw file):
Braces. toxcore/tox.c, line 568 at r3 (raw file):
Add either a bug number or github username in parentheses after TODO. See #133. Comments from Reviewable |
Review status: 1 of 6 files reviewed at latest revision, 13 unresolved discussions, some commit checks failed. auto_tests/tox_loop_test.c, line 43 at r1 (raw file):
|
189e0e5
to
662d07d
Compare
Review status: 1 of 6 files reviewed at latest revision, 12 unresolved discussions. auto_tests/tox_loop_test.c, line 43 at r1 (raw file):
|
662d07d
to
bd39b88
Compare
Review status: 1 of 6 files reviewed at latest revision, 12 unresolved discussions. toxcore/tox.c, line 494 at r3 (raw file):
|
Review status: 1 of 6 files reviewed at latest revision, 17 unresolved discussions. auto_tests/tox_loop_test.c, line 43 at r1 (raw file):
|
Review status: 1 of 6 files reviewed at latest revision, 17 unresolved discussions. toxcore/tox.c, line 568 at r3 (raw file):
|
Review status: 1 of 6 files reviewed at latest revision, 10 unresolved discussions. toxcore/tox.c, line 492 at r3 (raw file):
|
Review status: 1 of 6 files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. toxcore/tox.c, line 557 at r5 (raw file):
This realloc() call needs error handling, and fdlist needs to be free'd before the function exits. toxcore/tox.c, line 567 at r5 (raw file):
Assigning a uint32_t to an int is a bad idea. Same goes for the implicit cast with FD_SET(). Probably not a pragmatic concern here but it's bad form. Why isn't fdlist an int array? Comments from Reviewable |
Review status: 1 of 6 files reviewed at latest revision, 11 unresolved discussions, some commit checks failed. toxcore/tox.c, line 567 at r5 (raw file):
|
Reviewed 1 of 8 files at r1. a discussion (no related file): IMO this should be done a lot closer to net_crpyto or network even. Why did you choose tox.c and messenger.h for the logic/data other/apidsl/tox.in.h, line 826 at r5 (raw file):
I Suggest:
Comments from Reviewable |
What's the progress on this? Can you rebase and fix the conflicts? |
need to set aside some time to fix all of the things commented on and rebase |
Hey! How is it going? It seems to be a very important core update |
@vassad: this has been taken on by @Ansa89 in #335. I'm closing this one in favour of that one. @cleverca22 can push commits to @Ansa89's branch. |
Right, I meant @Ansa89. Sorry about that. |
this PR adds a tox_loop() function that will block on the network sockets and call tox_iterate automatically
along with 2 callbacks to allow a client to manage a mutex to maintain thread safety
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)