提交 c78ad637 编写于 作者: R Romain Vimont

Terminate the server on stop

On user request to quit, two kinds of blocking calls must be interrupted
on the server:
 1. the reads from and writes to the socket;
 2. the call to MediaCodec.dequeueOutputBuffer().

The former case was handled by calling shutdown() on the socket from the
client, but the latter was not managed.

There is no easy way to wake this call properly, so just terminate the
process from the client (i.e. send SIGTERM on Linux) instead.
上级 b61310a2
......@@ -143,14 +143,10 @@ socket_t server_connect_to(struct server *server, const char *serial, Uint32 tim
void server_stop(struct server *server, const char *serial) {
SDL_assert(server->process != PROCESS_NONE);
if (server->device_socket != INVALID_SOCKET) {
// shutdown the socket to finish the device process gracefully
if (!net_shutdown(server->device_socket, SHUT_RDWR)) {
LOGW("Cannot shutdown socket");
}
if (!cmd_terminate(server->process)) {
LOGW("Cannot terminate server");
}
LOGD("Waiting the server to complete execution on the device...");
cmd_simple_wait(server->process, NULL); // ignore exit code
LOGD("Server terminated");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册