Commit fbe8d5ff by Marcus Winter

mtapi_network_c: fixed crash on disconnect

parent 916bd026
...@@ -158,7 +158,7 @@ static void embb_mtapi_network_task_complete( ...@@ -158,7 +158,7 @@ static void embb_mtapi_network_task_complete(
assert(err == 4); assert(err == 4);
err = embb_mtapi_network_buffer_push_back_rawdata( err = embb_mtapi_network_buffer_push_back_rawdata(
&send_buf, local_task->result_size, local_task->result_buffer); &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( err = embb_mtapi_network_socket_sendbuffer(
&network_task->socket, &send_buf); &network_task->socket, &send_buf);
...@@ -213,6 +213,10 @@ static int embb_mtapi_network_thread(void * args) { ...@@ -213,6 +213,10 @@ static int embb_mtapi_network_thread(void * args) {
err = embb_mtapi_network_socket_recvbuffer_sized( err = embb_mtapi_network_socket_recvbuffer_sized(
socket, &buffer, 1); socket, &buffer, 1);
if (err == 0) {
// there was some socket error, ignore
continue;
}
assert(err == 1); assert(err == 1);
err = embb_mtapi_network_buffer_pop_front_int8( err = embb_mtapi_network_buffer_pop_front_int8(
&buffer, &operation); &buffer, &operation);
...@@ -500,7 +504,7 @@ static void network_task_start( ...@@ -500,7 +504,7 @@ static void network_task_start(
assert(err == 4); assert(err == 4);
err = embb_mtapi_network_buffer_push_back_rawdata( err = embb_mtapi_network_buffer_push_back_rawdata(
send_buf, local_task->arguments_size, local_task->arguments); 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( err = embb_mtapi_network_socket_sendbuffer(
&network_action->socket, send_buf); &network_action->socket, send_buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment