Kill the server only after some delay

Let the server terminate properly once all the sockets are closed.

If it does not terminate (this can happen if the device is asleep), then
kill it.

Fixes #1992 <https://github.com/Genymobile/scrcpy/issues/1992>
This commit is contained in:
Romain Vimont
2021-01-01 12:41:25 +01:00
parent 83910d3b9c
commit e2ddea9df5
2 changed files with 46 additions and 2 deletions

View File

@@ -18,6 +18,11 @@ struct server {
process_t process;
SDL_Thread *wait_server_thread;
atomic_flag server_socket_closed;
SDL_mutex *mutex;
SDL_cond *process_terminated_cond;
bool process_terminated;
socket_t server_socket; // only used if !tunnel_forward
socket_t video_socket;
socket_t control_socket;