Skip to content
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
2 changes: 2 additions & 0 deletions src/cpp/fastdds/publisher/DataWriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,8 @@ void DataWriterImpl::InnerDataWriterListener::on_writer_matched(
RTPSWriter* /*writer*/,
const MatchingInfo& info)
{
std::lock_guard<std::mutex> scoped_lock(matching_info_mutex_);

data_writer_->update_publication_matched_status(info);

StatusMask notify_status = StatusMask::publication_matched();
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/fastdds/publisher/DataWriterImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,10 @@ class DataWriterImpl : protected rtps::IReaderDataFilter
const uint32_t& status_id);
#endif //FASTDDS_STATISTICS

private:

DataWriterImpl* data_writer_;
std::mutex matching_info_mutex_;
}
writer_listener_;

Expand Down
2 changes: 2 additions & 0 deletions src/cpp/fastdds/subscriber/DataReaderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,8 @@ void DataReaderImpl::InnerDataReaderListener::on_reader_matched(
RTPSReader* /*reader*/,
const MatchingInfo& info)
{
std::lock_guard<std::mutex> scoped_lock(matching_info_mutex_);

data_reader_->update_subscription_matched_status(info);

StatusMask notify_status = StatusMask::subscription_matched();
Expand Down
3 changes: 3 additions & 0 deletions src/cpp/fastdds/subscriber/DataReaderImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,10 @@ class DataReaderImpl
const uint32_t& status_id);
#endif //FASTDDS_STATISTICS

private:

DataReaderImpl* data_reader_;
std::mutex matching_info_mutex_;

}
reader_listener_;
Expand Down
114 changes: 58 additions & 56 deletions src/cpp/rtps/builtin/discovery/endpoint/EDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ bool EDP::unpairWriterProxy(
#endif // if HAVE_SECURITY

//MATCHED AND ADDED CORRECTLY:
ReaderListener* listener = nullptr;
if (nullptr != (listener = r.get_listener()))
ReaderListener* listener = r.get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
Expand Down Expand Up @@ -834,8 +834,8 @@ bool EDP::unpairReaderProxy(
participant_guid, reader_guid);
#endif // if HAVE_SECURITY
//MATCHED AND ADDED CORRECTLY:
WriterListener* listener = nullptr;
if (nullptr != (listener = w.get_listener()))
WriterListener* listener = w.get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
Expand Down Expand Up @@ -1144,40 +1144,39 @@ bool EDP::pairingReader(
"WP:" << wdatait->guid << " match R:" << reader_guid << ". RLoc:" <<
wdatait->remote_locators);
//MATCHED AND ADDED CORRECTLY:
if (reader->get_listener() != nullptr)
ReaderListener* listener = reader->get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = MATCHED_MATCHING;
info.remoteEndpointGuid = writer_guid;
reader->get_listener()->on_reader_matched(reader, info);
listener->on_reader_matched(reader, info);
}
}
#endif // if HAVE_SECURITY
}
else
{
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && reader->get_listener() != nullptr)
ReaderListener* listener = reader->get_listener();
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && (nullptr != listener))
{
reader->get_listener()->on_requested_incompatible_qos(reader, incompatible_qos);
listener->on_requested_incompatible_qos(reader, incompatible_qos);
mp_PDP->notify_incompatible_qos_matching(R->getGuid(), wdatait->guid, incompatible_qos);
}

//EPROSIMA_LOG_INFO(RTPS_EDP,RTPS_CYAN<<"Valid Matching to writerProxy: "<<wdatait->guid<<RTPS_DEF<<endl);
if (reader->matched_writer_is_matched(wdatait->guid)
&& reader->matched_writer_remove(wdatait->guid))
if (reader->matched_writer_is_matched(wdatait->guid) && reader->matched_writer_remove(wdatait->guid))
{
#if HAVE_SECURITY
mp_RTPSParticipant->security_manager().remove_writer(reader_guid, participant_guid,
wdatait->guid);
mp_RTPSParticipant->security_manager().remove_writer(reader_guid, participant_guid, wdatait->guid);
#endif // if HAVE_SECURITY

//MATCHED AND ADDED CORRECTLY:
if (reader->get_listener() != nullptr)
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
info.remoteEndpointGuid = writer_guid;
reader->get_listener()->on_reader_matched(reader, info);
listener->on_reader_matched(reader, info);
}
}
}
Expand Down Expand Up @@ -1237,21 +1236,23 @@ bool EDP::pairingWriter(
"RP:" << rdatait->guid << " match W:" << writer_guid << ". WLoc:" <<
rdatait->remote_locators);
//MATCHED AND ADDED CORRECTLY:
if (writer->get_listener() != nullptr)
WriterListener* listener = writer->get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = MATCHED_MATCHING;
info.remoteEndpointGuid = reader_guid;
writer->get_listener()->on_writer_matched(writer, info);
listener->on_writer_matched(writer, info);
}
}
#endif // if HAVE_SECURITY
}
else
{
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && writer->get_listener() != nullptr)
WriterListener* listener = writer->get_listener();
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && (nullptr != listener))
{
writer->get_listener()->on_offered_incompatible_qos(writer, incompatible_qos);
listener->on_offered_incompatible_qos(writer, incompatible_qos);
mp_PDP->notify_incompatible_qos_matching(W->getGuid(), rdatait->guid, incompatible_qos);
}

Expand All @@ -1262,12 +1263,12 @@ bool EDP::pairingWriter(
mp_RTPSParticipant->security_manager().remove_reader(writer_guid, participant_guid, reader_guid);
#endif // if HAVE_SECURITY
//MATCHED AND ADDED CORRECTLY:
if (writer->get_listener() != nullptr)
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
info.remoteEndpointGuid = reader_guid;
writer->get_listener()->on_writer_matched(writer, info);
listener->on_writer_matched(writer, info);
}
}
}
Expand Down Expand Up @@ -1313,38 +1314,39 @@ bool EDP::pairing_reader_proxy_with_any_local_writer(
"RP:" << rdata->guid << " match W:" << w.getGuid() << ". RLoc:" <<
rdata->remote_locators);
//MATCHED AND ADDED CORRECTLY:
if (w.get_listener() != nullptr)
WriterListener* listener = w.get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = MATCHED_MATCHING;
info.remoteEndpointGuid = reader_guid;
w.get_listener()->on_writer_matched(&w, info);
listener->on_writer_matched(&w, info);
}
}
#endif // if HAVE_SECURITY
}
else
{
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && w.get_listener() != nullptr)
WriterListener* listener = w.get_listener();
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && (nullptr != listener))
{
w.get_listener()->on_offered_incompatible_qos(&w, incompatible_qos);
listener->on_offered_incompatible_qos(&w, incompatible_qos);
mp_PDP->notify_incompatible_qos_matching(w.getGuid(), rdata->guid, incompatible_qos);
}

if (w.matched_reader_is_matched(reader_guid)
&& w.matched_reader_remove(reader_guid))
if (w.matched_reader_is_matched(reader_guid) && w.matched_reader_remove(reader_guid))
{
#if HAVE_SECURITY
mp_RTPSParticipant->security_manager().remove_reader(
w.getGuid(), participant_guid, reader_guid);
#endif // if HAVE_SECURITY
//MATCHED AND ADDED CORRECTLY:
if (w.get_listener() != nullptr)
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
info.remoteEndpointGuid = reader_guid;
w.get_listener()->on_writer_matched(&w, info);
listener->on_writer_matched(&w, info);
}
}
}
Expand Down Expand Up @@ -1393,25 +1395,24 @@ bool EDP::pairing_reader_proxy_with_local_writer(
}
else
{
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) &&
w.get_listener() != nullptr)
WriterListener* listener = w.get_listener();
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && (nullptr != listener))
{
w.get_listener()->on_offered_incompatible_qos(&w, incompatible_qos);
listener->on_offered_incompatible_qos(&w, incompatible_qos);
mp_PDP->notify_incompatible_qos_matching(local_writer, rdata.guid, incompatible_qos);
}

if (w.matched_reader_is_matched(reader_guid)
&& w.matched_reader_remove(reader_guid))
if (w.matched_reader_is_matched(reader_guid) && w.matched_reader_remove(reader_guid))
{
mp_RTPSParticipant->security_manager().remove_reader(w.getGuid(),
remote_participant_guid, reader_guid);
//MATCHED AND ADDED CORRECTLY:
if (w.get_listener() != nullptr)
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
info.remoteEndpointGuid = reader_guid;
w.get_listener()->on_writer_matched(&w, info);
listener->on_writer_matched(&w, info);
}
}
}
Expand Down Expand Up @@ -1448,12 +1449,13 @@ bool EDP::pairing_remote_reader_with_local_writer_after_security(
matched = true;

//MATCHED AND ADDED CORRECTLY:
if (w.get_listener() != nullptr)
WriterListener* listener = w.get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = MATCHED_MATCHING;
info.remoteEndpointGuid = reader_guid;
w.get_listener()->on_writer_matched(&w, info);
listener->on_writer_matched(&w, info);
}
}
// don't look anymore
Expand Down Expand Up @@ -1506,38 +1508,39 @@ bool EDP::pairing_writer_proxy_with_any_local_reader(
"WP:" << wdata->guid << " match R:" << r.getGuid() << ". WLoc:" <<
wdata->remote_locators);
//MATCHED AND ADDED CORRECTLY:
if (r.get_listener() != nullptr)
ReaderListener* listener = r.get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = MATCHED_MATCHING;
info.remoteEndpointGuid = writer_guid;
r.get_listener()->on_reader_matched(&r, info);
listener->on_reader_matched(&r, info);
}
}
#endif // if HAVE_SECURITY
}
else
{
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && r.get_listener() != nullptr)
ReaderListener* listener = r.get_listener();
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && (nullptr != listener))
{
r.get_listener()->on_requested_incompatible_qos(&r, incompatible_qos);
listener->on_requested_incompatible_qos(&r, incompatible_qos);
mp_PDP->notify_incompatible_qos_matching(r.getGuid(), wdata->guid, incompatible_qos);
}

if (r.matched_writer_is_matched(writer_guid)
&& r.matched_writer_remove(writer_guid))
if (r.matched_writer_is_matched(writer_guid) && r.matched_writer_remove(writer_guid))
{
#if HAVE_SECURITY
mp_RTPSParticipant->security_manager().remove_writer(readerGUID, participant_guid,
writer_guid);
#endif // if HAVE_SECURITY
//MATCHED AND ADDED CORRECTLY:
if (r.get_listener() != nullptr)
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
info.remoteEndpointGuid = writer_guid;
r.get_listener()->on_reader_matched(&r, info);
listener->on_reader_matched(&r, info);
}
}
}
Expand Down Expand Up @@ -1586,25 +1589,24 @@ bool EDP::pairing_writer_proxy_with_local_reader(
}
else
{
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) &&
r.get_listener() != nullptr)
ReaderListener* listener = r.get_listener();
if (no_match_reason.test(MatchingFailureMask::incompatible_qos) && (nullptr != listener))
{
r.get_listener()->on_requested_incompatible_qos(&r, incompatible_qos);
listener->on_requested_incompatible_qos(&r, incompatible_qos);
mp_PDP->notify_incompatible_qos_matching(local_reader, wdata.guid, incompatible_qos);
}

if (r.matched_writer_is_matched(writer_guid)
&& r.matched_writer_remove(writer_guid))
if (r.matched_writer_is_matched(writer_guid) && r.matched_writer_remove(writer_guid))
{
mp_RTPSParticipant->security_manager().remove_writer(readerGUID,
remote_participant_guid, writer_guid);
//MATCHED AND ADDED CORRECTLY:
if (r.get_listener() != nullptr)
if (nullptr != listener)
{
MatchingInfo info;
info.status = REMOVED_MATCHING;
info.remoteEndpointGuid = writer_guid;
r.get_listener()->on_reader_matched(&r, info);
listener->on_reader_matched(&r, info);
}
}
}
Expand Down Expand Up @@ -1643,13 +1645,13 @@ bool EDP::pairing_remote_writer_with_local_reader_after_security(
matched = true;

//MATCHED AND ADDED CORRECTLY:
if (r.get_listener() != nullptr)
ReaderListener* listener = r.get_listener();
if (nullptr != listener)
{
MatchingInfo info;
info.status = MATCHED_MATCHING;
info.remoteEndpointGuid = writer_guid;
r.get_listener()->on_reader_matched(&r, info);

listener->on_reader_matched(&r, info);
}
}
// dont' look anymore
Expand Down
Loading
Loading