Skip to content

Commit

Permalink
Remove unnecesary error log msg when opening a SHM port. (eProsima#1095)
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfomarver authored Mar 25, 2020
1 parent 4ec3610 commit 37bf0dd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/cpp/rtps/transport/shared_mem/SharedMemGlobal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ class SharedMemGlobal
uint32_t healthy_check_timeout_ms,
Port::OpenMode open_mode = Port::OpenMode::ReadShared)
{
std::string err_reason;
std::shared_ptr<Port> port;

auto port_segment_name = domain_name_ + "_port" + std::to_string(port_id);
Expand Down Expand Up @@ -464,10 +465,12 @@ class SharedMemGlobal
if ( (port_node->is_opened_read_exclusive && open_mode != Port::OpenMode::Write) ||
(port_node->is_opened_for_reading && open_mode == Port::OpenMode::ReadExclusive))
{
logError(RTPS_TRANSPORT_SHM, THREADID << "Couln't open Port "
<< port_node->port_id << " (" << port_node->uuid.to_string() <<
") for reading because is exclusive");
std::stringstream ss;

ss << port_node->port_id << " (" << port_node->uuid.to_string() <<
") because is already opened ReadExclusive";

err_reason = ss.str();
port.reset();
}
else
Expand Down Expand Up @@ -540,7 +543,7 @@ class SharedMemGlobal

if (port == nullptr)
{
throw std::runtime_error("Coulnd't open port ");
throw std::runtime_error("Coulnd't open port " + err_reason);
}

return port;
Expand Down

0 comments on commit 37bf0dd

Please sign in to comment.