Skip to content

Commit

Permalink
Linters
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany committed May 28, 2020
1 parent 3e14a6b commit 13c540b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class ClientListener : public eprosima::fastrtps::SubscriberListener
response.sample_identity_ = response.sample_info_.related_sample_identity;

if (response.sample_identity_.writer_guid() == info_->reader_guid_ ||
response.sample_identity_.writer_guid() == info_->writer_guid_) {
response.sample_identity_.writer_guid() == info_->writer_guid_)
{
std::lock_guard<std::mutex> lock(internalMutex_);

if (conditionMutex_ != nullptr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <condition_variable>
#include <list>
#include <mutex>
#include <set>

#include "fastcdr/FastBuffer.h"

Expand Down Expand Up @@ -87,7 +88,7 @@ class ServiceListener : public eprosima::fastrtps::SubscriberListener
if (eprosima::fastrtps::rtps::ALIVE == request.sample_info_.sampleKind) {
request.sample_identity_ = request.sample_info_.sample_identity;
// Use response subscriber guid (on related_sample_identity) when present.
const eprosima::fastrtps::rtps::GUID_t& reader_guid =
const eprosima::fastrtps::rtps::GUID_t & reader_guid =
request.sample_info_.related_sample_identity.writer_guid();
if (reader_guid != eprosima::fastrtps::rtps::GUID_t::unknown() ) {
request.sample_identity_.writer_guid() = reader_guid;
Expand Down Expand Up @@ -170,18 +171,18 @@ class ServiceListener : public eprosima::fastrtps::SubscriberListener
class ServicePubListener : public eprosima::fastrtps::PublisherListener
{
public:
explicit ServicePubListener() = default;
template< class Rep, class Period >
ServicePubListener() = default;

template<class Rep, class Period>
bool wait_for_subscription(
const eprosima::fastrtps::rtps::GUID_t & guid,
const std::chrono::duration<Rep, Period> & rel_time)
{
auto guid_is_present = [this, guid]() -> bool
{
return subscriptions_.find(guid) != subscriptions_.end();
};
{
return subscriptions_.find(guid) != subscriptions_.end();
};

std::unique_lock<std::mutex> lock(mutex_);
return cv_.wait_for(lock, rel_time, guid_is_present);
}
Expand Down
6 changes: 3 additions & 3 deletions rmw_fastrtps_shared_cpp/src/rmw_response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ __rmw_send_response(
constexpr uint8_t entity_id_is_reader_bit = 0x04;
const eprosima::fastrtps::rtps::GUID_t & related_guid =
wparams.related_sample_identity().writer_guid();
if((related_guid.entityId.value[3] & entity_id_is_reader_bit) != 0)
{
if ((related_guid.entityId.value[3] & entity_id_is_reader_bit) != 0) {
// Related guid is a reader, so it is the response subscription guid.
// Wait for the response writer to be matched with it.
if(!info->pub_listener_->wait_for_subscription(related_guid, std::chrono::milliseconds(100))) {
auto listener = info->pub_listener_;
if (!listener->wait_for_subscription(related_guid, std::chrono::milliseconds(100))) {
RMW_SET_ERROR_MSG("client will not receive response");
return RMW_RET_ERROR;
}
Expand Down

0 comments on commit 13c540b

Please sign in to comment.