diff options
Diffstat (limited to 'src/slave_rpc.c')
-rw-r--r-- | src/slave_rpc.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/slave_rpc.c b/src/slave_rpc.c index 2aa8229..4853d97 100644 --- a/src/slave_rpc.c +++ b/src/slave_rpc.c @@ -19,6 +19,7 @@ #include <errno.h> /* errno */ #include <unistd.h> /* pid_t */ #include <stdlib.h> /* free */ +#include <assert.h> #include <Eina.h> #include <Ecore.h> @@ -291,18 +292,29 @@ static int slave_deactivate_cb(struct slave_node *slave, void *data) ErrPrint("slave has no pong timer\n"); } - EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) { - if (command->slave == slave) { - s_info.command_list = eina_list_remove(s_info.command_list, command); + if (rpc->handle < 0) { + EINA_LIST_FREE(rpc->pending_list, command) { + assert(command->slave == slave); + if (command->ret_cb) + command->ret_cb(command->slave, NULL, command->cbdata); destroy_command(command); } + } else { + EINA_LIST_FOREACH_SAFE(s_info.command_list, l, n, command) { + if (command->slave == slave) { + s_info.command_list = eina_list_remove(s_info.command_list, command); + if (command->ret_cb) + command->ret_cb(command->slave, NULL, command->cbdata); + destroy_command(command); + } + } } /*! * \note * Reset handle */ - DbgPrint("Reset handle for %d\n", slave_pid(slave)); + DbgPrint("Reset handle for %d (%d)\n", slave_pid(slave), rpc->handle); rpc->handle = -1; /*! |