Skip to content

Commit

Permalink
Update XRCE entities creation procedure (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogs9 authored Nov 16, 2020
1 parent b969cca commit b9770e1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
14 changes: 12 additions & 2 deletions rmw_microxrcedds_c/src/rmw_publisher.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ rmw_create_publisher(
custom_node->participant_id, "", UXR_REPLACE);
#endif

uint16_t requests[] = {publisher_req};
uint8_t status[sizeof(requests) / 2];
if (!uxr_run_session_until_all_status(
&custom_publisher->owner_node->context->session, 1000, requests,
status, sizeof(status)))
{
RMW_SET_ERROR_MSG("Issues creating micro XRCE-DDS entities");
put_memory(&publisher_memory, &custom_publisher->mem);
goto fail;
}

custom_publisher->datawriter_id = uxr_object_id(
custom_node->context->id_datawriter++,
UXR_DATAWRITER_ID);
Expand Down Expand Up @@ -201,8 +212,7 @@ rmw_create_publisher(

rmw_publisher->data = custom_publisher;

uint16_t requests[] = {publisher_req, datawriter_req};
uint8_t status[sizeof(requests) / 2];
requests[0] = datawriter_req;
if (!uxr_run_session_until_all_status(
&custom_publisher->owner_node->context->session, 1000, requests,
status, sizeof(status)))
Expand Down
13 changes: 11 additions & 2 deletions rmw_microxrcedds_c/src/rmw_subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ rmw_create_subscription(
custom_node->participant_id, "", UXR_REPLACE);
#endif

uint16_t requests[] = {subscriber_req};
uint8_t status[sizeof(requests) / 2];
if (!uxr_run_session_until_all_status(
&custom_node->context->session, 1000, requests,
status, sizeof(status)))
{
RMW_SET_ERROR_MSG("Issues creating Micro XRCE-DDS entities");
put_memory(&subscription_memory, &custom_subscription->mem);
goto fail;
}

custom_subscription->datareader_id = uxr_object_id(
custom_node->context->id_datareader++,
Expand Down Expand Up @@ -200,8 +210,7 @@ rmw_create_subscription(

rmw_subscription->data = custom_subscription;

uint16_t requests[] = {subscriber_req, datareader_req};
uint8_t status[sizeof(requests) / 2];
requests[0] = datareader_req;
if (!uxr_run_session_until_all_status(
&custom_node->context->session, 1000, requests,
status, sizeof(status)))
Expand Down

0 comments on commit b9770e1

Please sign in to comment.