Display and control your Android device
Disable custom SDL signal handlers
Romain Vimontf00c6c5b1321
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.cindex 5e8a79fb..204cad4f 100644--- a/app/src/scrcpy.c+++ b/app/src/scrcpy.c@@ -113,16 +113,16 @@ SDL_bool scrcpy(const char *serial, Uint16 local_port, Uint16 max_size, Uint32 bSDL_bool ret = SDL_TRUE;+ if (!SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1")) {+ LOGW("Cannot request to keep default signal handlers");+ }+if (!sdl_init_and_configure()) {ret = SDL_FALSE;goto finally_destroy_server;}- // SDL initialization replace the signal handler for SIGTERM, so Ctrl+C is- // managed by the event loop. This blocking call blocks the event loop, so- // timeout the connection not to block indefinitely in case of SIGTERM.-#define SERVER_CONNECT_TIMEOUT_MS 2000- socket_t device_socket = server_connect_to(&server, SERVER_CONNECT_TIMEOUT_MS);+ socket_t device_socket = server_connect_to(&server);if (device_socket == INVALID_SOCKET) {server_stop(&server);ret = SDL_FALSE;diff --git a/app/src/server.c b/app/src/server.cindex ede701c0..745a785d 100644--- a/app/src/server.c+++ b/app/src/server.c@@ -195,7 +195,7 @@ SDL_bool server_start(struct server *server, const char *serial, Uint16 local_poreturn SDL_TRUE;}-socket_t server_connect_to(struct server *server, Uint32 timeout_ms) {+socket_t server_connect_to(struct server *server) {if (!server->tunnel_forward) {server->device_socket = net_accept(server->server_socket);} else {diff --git a/app/src/server.h b/app/src/server.hindex fcd44b8d..13541457 100644--- a/app/src/server.h+++ b/app/src/server.h@@ -34,7 +34,7 @@ SDL_bool server_start(struct server *server, const char *serial, Uint16 local_poUint16 max_size, Uint32 bit_rate);// block until the communication with the server is established-socket_t server_connect_to(struct server *server, Uint32 timeout_ms);+socket_t server_connect_to(struct server *server);// disconnect and kill the server processvoid server_stop(struct server *server);