Kill the server immediately on close

Do not wait 100ms anymore to let the server print any exception: we
justly want to ignore them.

Moreover, there is no nanosleep() on Windows, so this solve another
problem.
This commit is contained in:
Romain Vimont 2018-02-09 11:01:50 +01:00
parent c683872bbc
commit 7458d8271e

View File

@ -4,7 +4,6 @@
#include <SDL2/SDL_net.h>
#include <errno.h>
#include <stdint.h>
#include <time.h>
#include "netutil.h"
#define SOCKET_NAME "scrcpy"
@ -123,13 +122,6 @@ void server_stop(struct server *server, const char *serial) {
SDLNet_TCP_Close(server->device_socket);
}
// let the server some time to print any exception trace before killing it
struct timespec timespec = {
.tv_sec = 0,
.tv_nsec = 100000000, // 100ms
};
nanosleep(&timespec, NULL); // ignore error
terminate_server(server->process);
if (server->adb_reverse_enabled) {