From fbe8d5ffba275859f8a2e0831b7e364af0a666aa Mon Sep 17 00:00:00 2001 From: Marcus Winter Date: Mon, 2 Mar 2015 12:29:05 +0100 Subject: [PATCH] mtapi_network_c: fixed crash on disconnect --- mtapi_network_c/src/embb_mtapi_network.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mtapi_network_c/src/embb_mtapi_network.c b/mtapi_network_c/src/embb_mtapi_network.c index f30fb61..4f657c9 100644 --- a/mtapi_network_c/src/embb_mtapi_network.c +++ b/mtapi_network_c/src/embb_mtapi_network.c @@ -158,7 +158,7 @@ static void embb_mtapi_network_task_complete( assert(err == 4); err = embb_mtapi_network_buffer_push_back_rawdata( &send_buf, local_task->result_size, local_task->result_buffer); - assert(err == local_task->result_size); + assert(err == (int)local_task->result_size); err = embb_mtapi_network_socket_sendbuffer( &network_task->socket, &send_buf); @@ -213,6 +213,10 @@ static int embb_mtapi_network_thread(void * args) { err = embb_mtapi_network_socket_recvbuffer_sized( socket, &buffer, 1); + if (err == 0) { + // there was some socket error, ignore + continue; + } assert(err == 1); err = embb_mtapi_network_buffer_pop_front_int8( &buffer, &operation); @@ -500,7 +504,7 @@ static void network_task_start( assert(err == 4); err = embb_mtapi_network_buffer_push_back_rawdata( send_buf, local_task->arguments_size, local_task->arguments); - assert(err == local_task->arguments_size); + assert(err == (int)local_task->arguments_size); err = embb_mtapi_network_socket_sendbuffer( &network_action->socket, send_buf); -- libgit2 0.26.0