-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Rewrite non-libuv tcp server and drop libuv #2857
Conversation
074a964
to
d5b9a30
Compare
The non-libuv tcp server implementation had several issues: * Relied on EINTR or self-connect through global vars for breaking, which did not work during recv() for example. * Never retried on EINTR * Called recv() only once, thus subject to fragmentation issues To support breaking otherwise blocking socket calls, RzStopPipe has been imported from chiaki (I am the sole author so I can relicense). rz_socket_block_time() was also detected to be doing the exact opposite than it should on Windows through the tests, and fixed.
libuv was only ever used for the tcp server for almost 4 years. Since the non-libuv implementation of that is working now, it can be dropped entirely without sacrificing functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resend this from dist-asan-fuzz-
branch, please.
@GustavoLCR could you please take a look if everything is fine from the Windows point of view?
|
||
uv_tcp_t *client = RZ_NEW(uv_tcp_t); | ||
if (!client) { | ||
RZ_API void rz_core_rtr_cmds(RzCore *core, const char *port) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doxygen, please
@@ -716,7 +724,7 @@ RZ_API char *rz_socket_to_string(RzSocket *s) { | |||
} | |||
return str; | |||
#else | |||
return NULL; | |||
return NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this indentation intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format enforces it, but it makes no sense imo.
#endif | ||
}; // RzStopPipe | ||
|
||
RZ_API RzStopPipe *rz_stop_pipe_new(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doxygen with explanation what exactly RzStopPipe is?
Superseded by #2860 |
DO NOT SQUASH
Your checklist for this pull request
Detailed description
Despite being a fantastic library, libuv was only ever used for the tcp server for almost 4 years. This fixes the non-libuv tcp server and drops libuv in favor of it. See commit descriptions for details.
Test plan
Warning: if
tcp.islocal=false
, the following will open complete shell access to0.0.0.0
!rz -c "Rt 1337"
, then from another terminal do e.g.echo "?E hello" | nc localhost 1337
and see the command output.Ctrl+C should also break the
Rt
command properly.