Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fini Action Server and Client when node context is invalid + reset error #346

Merged
merged 1 commit into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rcl_action/src/rcl_action/action_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ rcl_action_client_fini(rcl_action_client_t * action_client, rcl_node_t * node)
if (!rcl_action_client_is_valid(action_client)) {
return RCL_RET_ACTION_CLIENT_INVALID; // error already set
}
if (!rcl_node_is_valid(node)) {
if (!rcl_node_is_valid_except_context(node)) {
return RCL_RET_NODE_INVALID; // error already set
}
rcl_ret_t ret = RCL_RET_OK;
Expand Down Expand Up @@ -396,22 +396,27 @@ rcl_action_client_is_valid(const rcl_action_client_t * action_client)
RCL_CHECK_FOR_NULL_WITH_MSG(
action_client->impl, "action client implementation is invalid", return false);
if (!rcl_client_is_valid(&action_client->impl->goal_client)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("goal client is invalid");
return false;
}
if (!rcl_client_is_valid(&action_client->impl->cancel_client)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("cancel client is invalid");
return false;
}
if (!rcl_client_is_valid(&action_client->impl->result_client)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("result client is invalid");
return false;
}
if (!rcl_subscription_is_valid(&action_client->impl->feedback_subscription)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("feedback subscription is invalid");
return false;
}
if (!rcl_subscription_is_valid(&action_client->impl->status_subscription)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("status subscription is invalid");
return false;
}
Expand Down
7 changes: 6 additions & 1 deletion rcl_action/src/rcl_action/action_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ rcl_ret_t
rcl_action_server_fini(rcl_action_server_t * action_server, rcl_node_t * node)
{
RCL_CHECK_ARGUMENT_FOR_NULL(action_server, RCL_RET_ACTION_SERVER_INVALID);
if (!rcl_node_is_valid(node)) {
if (!rcl_node_is_valid_except_context(node)) {
return RCL_RET_NODE_INVALID; // error already set
}

Expand Down Expand Up @@ -787,22 +787,27 @@ rcl_action_server_is_valid(const rcl_action_server_t * action_server)
RCL_CHECK_FOR_NULL_WITH_MSG(
action_server->impl, "action server implementation is invalid", return false);
if (!rcl_service_is_valid(&action_server->impl->goal_service)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("goal service is invalid");
return false;
}
if (!rcl_service_is_valid(&action_server->impl->cancel_service)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("cancel service is invalid");
return false;
}
if (!rcl_service_is_valid(&action_server->impl->result_service)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("result service is invalid");
return false;
}
if (!rcl_publisher_is_valid(&action_server->impl->feedback_publisher)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("feedback publisher is invalid");
return false;
}
if (!rcl_publisher_is_valid(&action_server->impl->status_publisher)) {
rcl_reset_error();
RCL_SET_ERROR_MSG("status publisher is invalid");
return false;
}
Expand Down