Timeout the server socket connection

Wait no more than 2 seconds for accepting the connection from the
device, since it blocks the event loop, preventing to react to SIGTERM
(Ctrl+C).
This commit is contained in:
Romain Vimont
2018-02-09 15:18:09 +01:00
parent 90a46b4c45
commit eb09fefd43
5 changed files with 12 additions and 12 deletions

View File

@@ -26,7 +26,7 @@ SDL_bool server_start(struct server *server, const char *serial, Uint16 local_po
Uint16 max_size, Uint32 bit_rate);
// block until the communication with the server is established
TCPsocket server_connect_to(struct server *server, const char *serial);
TCPsocket server_connect_to(struct server *server, const char *serial, Uint32 timeout_ms);
// disconnect and kill the server process
void server_stop(struct server *server, const char *serial);