Skip to content

Commit

Permalink
Refs #21314: Fix conflicts and build issues
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Sep 23, 2024
1 parent d5a09d8 commit a4eb611
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/cpp/fastdds/domain/DomainParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ bool DomainParticipantImpl::contains_entity(
ReturnCode_t DomainParticipantImpl::get_current_time(
fastrtps::Time_t& current_time) const
{
fastdds::dds::Time_t::now(current_time);
fastrtps::Time_t::now(current_time);

return ReturnCode_t::RETCODE_OK;
}
Expand Down
11 changes: 6 additions & 5 deletions src/cpp/fastdds/publisher/DataWriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1550,24 +1550,25 @@ bool DataWriterImpl::lifespan_expired()
{
std::unique_lock<RecursiveTimedMutex> lock(writer_->getMutex());

fastdds::rtps::Time_t current_ts;
fastdds::rtps::Time_t::now(current_ts);
fastrtps::Time_t current_ts;
fastrtps::Time_t::now(current_ts);

CacheChange_t* earliest_change;
while (history_.get_earliest_change(&earliest_change))
{
fastdds::rtps::Time_t expiration_ts = earliest_change->sourceTimestamp + qos_.lifespan().duration;
fastrtps::Time_t expiration_ts(earliest_change->sourceTimestamp.seconds(), earliest_change->sourceTimestamp.nanosec());
expiration_ts = expiration_ts + qos_.lifespan().duration;

// Check that the earliest change has expired (the change which started the timer could have been removed from the history)
if (current_ts < expiration_ts)
{
fastdds::rtps::Time_t interval = expiration_ts - current_ts;
fastrtps::Time_t interval = expiration_ts - current_ts;
lifespan_timer_->update_interval_millisec(interval.to_ns() * 1e-6);
return true;
}

// The earliest change has expired
history_->remove_change_pub(earliest_change);
history_.remove_change_pub(earliest_change);
}

return false;
Expand Down
18 changes: 10 additions & 8 deletions src/cpp/fastdds/subscriber/DataReaderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,9 +1123,10 @@ bool DataReaderImpl::on_new_cache_change_added(
return true;
}

fastdds::rtps::Time_t expiration_ts = change->sourceTimestamp + qos_.lifespan().duration;
fastdds::rtps::Time_t current_ts;
fastdds::rtps::Time_t::now(current_ts);
fastrtps::Time_t expiration_ts(change->sourceTimestamp.seconds(), change->sourceTimestamp.nanosec());
expiration_ts = expiration_ts + qos_.lifespan().duration;
fastrtps::Time_t current_ts;
fastrtps::Time_t::now(current_ts);

// The new change could have expired if it arrived too late
// If so, remove it from the history and return false to avoid notifying the listener
Expand Down Expand Up @@ -1153,7 +1154,7 @@ bool DataReaderImpl::on_new_cache_change_added(

// Update and restart the timer
// If the timer is already running this will not have any effect
fastdds::rtps::Time_t interval = expiration_ts - current_ts;
fastrtps::Time_t interval = expiration_ts - current_ts;
lifespan_timer_->update_interval_millisec(interval.to_ns() * 1e-6);
lifespan_timer_->restart_timer();
return true;
Expand Down Expand Up @@ -1273,18 +1274,19 @@ bool DataReaderImpl::lifespan_expired()
{
std::unique_lock<RecursiveTimedMutex> lock(reader_->getMutex());

fastdds::rtps::Time_t current_ts;
fastdds::rtps::Time_t::now(current_ts);
fastrtps::Time_t current_ts;
fastrtps::Time_t::now(current_ts);

CacheChange_t* earliest_change;
while (history_.get_earliest_change(&earliest_change))
{
fastdds::rtps::Time_t expiration_ts = earliest_change->sourceTimestamp + qos_.lifespan().duration;
fastrtps::Time_t expiration_ts(earliest_change->sourceTimestamp.seconds(), earliest_change->sourceTimestamp.nanosec());
expiration_ts = expiration_ts + qos_.lifespan().duration;

// Check that the earliest change has expired (the change which started the timer could have been removed from the history)
if (current_ts < expiration_ts)
{
fastdds::rtps::Time_t interval = expiration_ts - current_ts;
fastrtps::Time_t interval = expiration_ts - current_ts;
lifespan_timer_->update_interval_millisec(interval.to_ns() * 1e-6);
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/writer/StatefulWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ StatefulWriter::StatefulWriter(
, may_remove_change_(0)
, disable_heartbeat_piggyback_(att.disable_heartbeat_piggyback)
, disable_positive_acks_(att.disable_positive_acks)
, keep_duration_us_(att.keep_duration.to_ns() * 1e-3)
, keep_duration_(att.keep_duration.to_ns() * 1e-3)
, last_sequence_number_()
, biggest_removed_sequence_number_()
, sendBufferSize_(pimpl->get_min_network_send_buffer_size())
Expand Down Expand Up @@ -217,7 +217,7 @@ StatefulWriter::StatefulWriter(
, may_remove_change_(0)
, disable_heartbeat_piggyback_(att.disable_heartbeat_piggyback)
, disable_positive_acks_(att.disable_positive_acks)
, keep_duration_us_(att.keep_duration.to_ns() * 1e-3)
, keep_duration_(att.keep_duration.to_ns() * 1e-3)
, last_sequence_number_()
, biggest_removed_sequence_number_()
, sendBufferSize_(pimpl->get_min_network_send_buffer_size())
Expand Down

0 comments on commit a4eb611

Please sign in to comment.