diff --git a/libr/core/rtr.c b/libr/core/rtr.c index 70e7f80b40..4bed94eaf0 100644 --- a/libr/core/rtr.c +++ b/libr/core/rtr.c @@ -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"); diff --git a/libr/socket/http_server.c b/libr/socket/http_server.c index 636288330c..227aee3bd6 100644 --- a/libr/socket/http_server.c +++ b/libr/socket/http_server.c @@ -1,7 +1,12 @@ /* radare - LGPL - Copyright 2012-2014 - pancake */ #include - +#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