Skip to content

Commit f798b85

Browse files
authored
Merge pull request OpenDDS#5023 from mitza-oci/rtpsrelay-fixes
Updates from testing RtpsRelay
2 parents 5ed2c83 + f47cc3a commit f798b85

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

dds/DCPS/Message_Block_Ptr.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ class OpenDDS_Dcps_Export Message_Block_Shared_Ptr {
6161
return *this;
6262
}
6363

64+
#ifdef ACE_HAS_CPP11
65+
Message_Block_Shared_Ptr(Message_Block_Shared_Ptr&&) = default;
66+
Message_Block_Shared_Ptr& operator=(Message_Block_Shared_Ptr&&) = default;
67+
#endif
68+
6469
operator bool() const { return msg_.get(); }
6570

6671
ACE_Message_Block& operator*() const { return *msg_; }
@@ -123,7 +128,15 @@ class OpenDDS_Dcps_Export Lockable_Message_Block_Ptr {
123128
return *this;
124129
}
125130

126-
Lockable_Message_Block_Ptr& operator=(Lockable_Message_Block_Ptr&&) = default;
131+
Lockable_Message_Block_Ptr& operator=(Lockable_Message_Block_Ptr&& other)
132+
{
133+
if (&other != this) {
134+
// msgblock_ first so that this->msgblock_ can use this->lock_ in its own operator=
135+
msgblock_ = exchange(other.msgblock_, Message_Block_Shared_Ptr{});
136+
lock_ = exchange(other.lock_, Lock_Shared_Ptr{});
137+
}
138+
return *this;
139+
}
127140

128141
Lock_Policy lock_policy() const { return lock_ ? Lock_Policy::Use_Lock : Lock_Policy::No_Lock; }
129142

@@ -172,6 +185,15 @@ class OpenDDS_Dcps_Export Lockable_Message_Block_Ptr {
172185
}
173186
}
174187
};
188+
189+
// In C++14 this is std::exchange
190+
template <typename T, typename U = T>
191+
T exchange(T& from, U&& to)
192+
{
193+
const T old = std::move(from);
194+
from = std::forward<U>(to);
195+
return old;
196+
}
175197
};
176198
#endif
177199

dds/DCPS/RTPS/RtpsDiscovery.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ bool RtpsDiscovery::remove_domain_participant(
499499
if (domain->second.empty()) {
500500
participants_.erase(domain);
501501
}
502-
if (participants_.empty()) {
502+
if (participants_.empty() && stats_task_) {
503503
stats_task_->disable();
504504
}
505505
g.release();

dds/DCPS/RTPS/Spdp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4022,6 +4022,7 @@ Spdp::send_participant_crypto_tokens(const DCPS::GUID_t& id)
40224022
DDS::Security::ParticipantVolatileMessageSecure msg;
40234023
msg.message_identity.source_guid = writer;
40244024
msg.related_message_identity.source_guid = GUID_UNKNOWN;
4025+
msg.related_message_identity.sequence_number = 0;
40254026
msg.message_class_id = DDS::Security::GMCLASSID_SECURITY_PARTICIPANT_CRYPTO_TOKENS;
40264027
msg.destination_participant_guid = peer;
40274028
msg.destination_endpoint_guid = GUID_UNKNOWN; // unknown = whole participant
@@ -4844,6 +4845,7 @@ void Spdp::fill_stats(DCPS::StatisticSeq& stats) const
48444845
stats[Stats_Index_TotalReaderPending].value = total_reader_pending_;
48454846
stats[Stats_Index_TotalReaderAssociated].value = total_reader_associated_;
48464847
stats[Stats_Index_DirectedGuids].value = tport_ ? tport_->directed_guids_.size() : 0;
4848+
sedp_->fill_stats(stats, Stats_Len);
48474849
}
48484850

48494851
DCPS::TopicStatus Spdp::assert_topic(GUID_t& topicId, const char* topicName,

docs/news.d/rtpsrelay-new-statistics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. news-prs: 4990 5000 5006
1+
.. news-prs: 4990 5000 5006 5023
22
33
.. news-start-section: Additions
44
- Output from :option:`RtpsRelay -LogRelayStatistics` / :option:`RtpsRelay -PublishRelayStatistics` includes internal OpenDDS statistics

tools/rtpsrelay/GuidAddrSet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class GuidAddrSet {
170170
, total_ips_(0)
171171
, total_ports_(0)
172172
, participant_admission_limit_reached_(false)
173+
, last_admit_(true)
173174
{}
174175

175176
using CreatedAddrSetStats = std::pair<bool, AddrSetStats&>;

0 commit comments

Comments
 (0)