mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 00:51:19 +00:00
Add timeout for accept in HTTP Server (#10375)
This commit is contained in:
parent
102eb99ea5
commit
c1cdc7a8b6
@ -466,6 +466,9 @@ static int r_core_rtr_http_run(RCore *core, int launch, const char *path) {
|
||||
eprintf ("Cannot listen on http.port\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
r_socket_block_time (s, 1, 1);
|
||||
|
||||
if (launch=='H') {
|
||||
const char *browser = r_config_get (core->config, "http.browser");
|
||||
r_sys_cmdf ("%s http://%s:%d/%s &",
|
||||
|
@ -559,7 +559,10 @@ R_API RSocket *r_socket_accept(RSocket *s) {
|
||||
//signal (SIGPIPE, SIG_DFL);
|
||||
sock->fd = accept (s->fd, (struct sockaddr *)&s->sa, &salen);
|
||||
if (sock->fd == -1) {
|
||||
r_sys_perror ("accept");
|
||||
if (errno != EWOULDBLOCK) {
|
||||
// not just a timeout
|
||||
r_sys_perror ("accept");
|
||||
}
|
||||
free (sock);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user