Commit 2aad5ee8 by Marcus Winter

mtapi_network_c: fixed group and buffer bugs

parent dcf26ae8
......@@ -40,6 +40,7 @@
#include <embb_mtapi_task_t.h>
#include <embb_mtapi_action_t.h>
#include <embb_mtapi_node_t.h>
#include <embb_mtapi_group_t.h>
#include <mtapi_status_t.h>
int embb_mtapi_network_initialize() {
......@@ -319,6 +320,15 @@ static int embb_mtapi_network_thread(void * args) {
local_task->error_code = task_status;
local_task->state = MTAPI_TASK_COMPLETED;
embb_atomic_fetch_and_add_int(&local_action->num_tasks, -1);
/* is task associated with a group? */
if (embb_mtapi_group_pool_is_handle_valid(
node->group_pool, local_task->group)) {
embb_mtapi_group_t* local_group =
embb_mtapi_group_pool_get_storage_for_handle(
node->group_pool, local_task->group);
embb_mtapi_task_queue_push(&local_group->queue, local_task);
}
}
}
}
......
......@@ -206,7 +206,11 @@ int embb_mtapi_network_socket_recvbuffer_sized(
if (size > (int)bytes_available)
return 0;
*/
err = recv(that->handle, buffer->data, size, 0);
if (0 < size) {
err = recv(that->handle, buffer->data, size, 0);
} else {
err = 0;
}
if (err != size)
return 0;
buffer->size = size;
......
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