From 205f32efb0038ec72c91b97050df26b56f882fae Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 24 Feb 2017 08:00:47 +0100 Subject: [PATCH] cient: shut down socket before stopping thread --- kernel/mars_client.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/mars_client.c b/kernel/mars_client.c index 2380dadf..6fdb9179 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -660,6 +660,13 @@ static int client_switch(struct client_brick *brick) if (brick->power.led_off) goto done; mars_power_led_on((void*)brick, false); + if (mars_get_socket(&output->socket)) { + if (mars_socket_is_alive(&output->socket)) { + MARS_DBG("shutdown socket\n"); + mars_shutdown_socket(&output->socket); + } + mars_put_socket(&output->socket); + } _kill_thread(&output->sender, "sender"); brick->connection_state = 0; if (!output->sender.thread) {