This commit is contained in:
skuater 2015-06-03 18:13:13 -04:00 committed by pancake
parent 225cc70e37
commit d7f6b4f6c6
2 changed files with 13 additions and 1 deletions

View File

@ -292,6 +292,9 @@ R_API int r_core_rtr_http_stop(RCore *u) {
const char *port;
const int timeout = 1; // 1 second
RCore *core = (RCore*)u;
#if __WINDOWS__
r_socket_http_server_set_breaked(1);
#endif
if (((size_t)u)>0xff) {
port = listenport? listenport: r_config_get (
core->config, "http.port");

View File

@ -1,7 +1,12 @@
/* radare - LGPL - Copyright 2012-2014 - pancake */
#include <r_socket.h>
#if __WINDOWS__
static int *breaked =NULL;
R_API void r_socket_http_server_set_breaked(int *b) {
breaked=b;
}
#endif
R_API RSocketHTTPRequest *r_socket_http_accept (RSocket *s, int timeout) {
int content_length = 0, xx, yy;
int pxx = 1, first = 0;
@ -15,6 +20,10 @@ R_API RSocketHTTPRequest *r_socket_http_accept (RSocket *s, int timeout) {
if (timeout>0)
r_socket_block_time (hr->s, 1, timeout);
for (;;) {
#if __WINDOWS__
if (breaked)
break;
#endif
memset (buf, 0, sizeof (buf));
xx = r_socket_gets (hr->s, buf, sizeof (buf));
yy = r_socket_ready (hr->s, 0, 20 * 1000); //this function uses usecs as argument