Skip to content

Commit

Permalink
iox-eclipse-iceoryx#252 Fix introspection handling in new API
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
  • Loading branch information
mossmaurice committed Dec 14, 2020
1 parent 0a3e3da commit bd1641d
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions iceoryx_posh/source/roudi/port_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ void PortManager::handlePublisherPorts() noexcept
PublisherPortRouDiType publisherPort(publisherPortData);

publisherPort.tryGetCaProMessage().and_then([&](auto caproMessage) {
m_portIntrospection.reportMessage(caproMessage);

if ((capro::CaproMessageType::OFFER == caproMessage.m_type)
|| (capro::CaproMessageType::STOP_OFFER == caproMessage.m_type))
if (capro::CaproMessageType::OFFER == caproMessage.m_type)
{
addEntryToServiceRegistry(caproMessage.m_serviceDescription.getServiceIDString(),
caproMessage.m_serviceDescription.getInstanceIDString());

sendToAllMatchingSubscriberPorts(caproMessage, publisherPort);
}
else if (capro::CaproMessageType::STOP_OFFER == caproMessage.m_type)
{
removeEntryFromServiceRegistry(caproMessage.m_serviceDescription.getServiceIDString(),
caproMessage.m_serviceDescription.getInstanceIDString());
}
else
{
Expand All @@ -154,6 +154,8 @@ void PortManager::handlePublisherPorts() noexcept
iox::ErrorLevel::MODERATE);
}

m_portIntrospection.reportMessage(caproMessage);
sendToAllMatchingSubscriberPorts(caproMessage, publisherPort);
// forward to interfaces
sendToAllMatchingInterfacePorts(caproMessage);
});
Expand All @@ -174,8 +176,6 @@ void PortManager::handleSubscriberPorts() noexcept
SubscriberPortType subscriberPort(subscriberPortData);

subscriberPort.tryGetCaProMessage().and_then([&](auto caproMessage) {
m_portIntrospection.reportMessage(caproMessage);

if ((capro::CaproMessageType::SUB == caproMessage.m_type)
|| (capro::CaproMessageType::UNSUB == caproMessage.m_type))
{
Expand All @@ -196,6 +196,8 @@ void PortManager::handleSubscriberPorts() noexcept
nullptr,
iox::ErrorLevel::MODERATE);
}

m_portIntrospection.reportMessage(caproMessage);
});

// check if we have to destroy this subscriber port
Expand Down Expand Up @@ -484,10 +486,11 @@ void PortManager::destroyPublisherPort(PublisherPortRouDiType::MemberType_t* con
caproMessage.m_serviceDescription.getInstanceIDString());
sendToAllMatchingSubscriberPorts(caproMessage, publisherPortRoudi);
sendToAllMatchingInterfacePorts(caproMessage);

m_portIntrospection.removePublisher(publisherPortRoudi.getProcessName(), caproMessage.m_serviceDescription);
});

m_portIntrospection.removePublisher(publisherPortRoudi.getProcessName(),
publisherPortRoudi.getCaProServiceDescription());

// delete publisher port from list after STOP_OFFER was processed
m_portPool->removePublisherPort(publisherPortData);

Expand All @@ -509,10 +512,10 @@ void PortManager::destroySubscriberPort(SubscriberPortType::MemberType_t* const

m_portIntrospection.reportMessage(caproMessage);
sendToAllMatchingPublisherPorts(caproMessage, subscriberPortRoudi);

m_portIntrospection.removeSubscriber(subscriberPortRoudi.getProcessName(), caproMessage.m_serviceDescription);
});

m_portIntrospection.removeSubscriber(subscriberPortRoudi.getProcessName(),
subscriberPortRoudi.getCaProServiceDescription());
// delete subscriber port from list after UNSUB was processed
m_portPool->removeSubscriberPort(subscriberPortData);

Expand Down

0 comments on commit bd1641d

Please sign in to comment.