Close server socket before killing process
The sockets may be closed and shutdown on server_stop(). This will interrupt the stream and controller threads more quickly and gracefully.
This commit is contained in:
parent
bfb86ca2c2
commit
47f1003200
1 changed files with 7 additions and 6 deletions
|
@ -248,6 +248,13 @@ server_connect_to(struct server *server) {
|
|||
|
||||
void
|
||||
server_stop(struct server *server) {
|
||||
if (server->server_socket != INVALID_SOCKET) {
|
||||
close_socket(&server->server_socket);
|
||||
}
|
||||
if (server->device_socket != INVALID_SOCKET) {
|
||||
close_socket(&server->device_socket);
|
||||
}
|
||||
|
||||
SDL_assert(server->process != PROCESS_NONE);
|
||||
|
||||
if (!cmd_terminate(server->process)) {
|
||||
|
@ -265,11 +272,5 @@ server_stop(struct server *server) {
|
|||
|
||||
void
|
||||
server_destroy(struct server *server) {
|
||||
if (server->server_socket != INVALID_SOCKET) {
|
||||
close_socket(&server->server_socket);
|
||||
}
|
||||
if (server->device_socket != INVALID_SOCKET) {
|
||||
close_socket(&server->device_socket);
|
||||
}
|
||||
SDL_free(server->serial);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue