Skip to content

Commit

Permalink
Protect asio exception hotfix (#4527)
Browse files Browse the repository at this point in the history
* Refs #20599: Handle error code before function call

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>

* Apply suggestion

Co-authored-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 08193d5)

# Conflicts:
#	src/cpp/rtps/transport/TCPTransportInterface.cpp
  • Loading branch information
cferreiragonz committed Mar 11, 2024
1 parent 1c7fda0 commit 281c046
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/cpp/rtps/transport/TCPTransportInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,43 @@ void TCPTransportInterface::clean()
}
}

<<<<<<< HEAD
=======
Locator TCPTransportInterface::remote_endpoint_to_locator(
const std::shared_ptr<TCPChannelResource>& channel) const
{
Locator locator;
asio::error_code ec;
auto endpoint = channel->remote_endpoint(ec);
if (ec)
{
LOCATOR_INVALID(locator);
}
else
{
endpoint_to_locator(endpoint, locator);
}
return locator;
}

Locator TCPTransportInterface::local_endpoint_to_locator(
const std::shared_ptr<TCPChannelResource>& channel) const
{
Locator locator;
asio::error_code ec;
auto endpoint = channel->local_endpoint(ec);
if (ec)
{
LOCATOR_INVALID(locator);
}
else
{
endpoint_to_locator(endpoint, locator);
}
return locator;
}

>>>>>>> 08193d5f7 (Protect asio exception hotfix (#4527))
void TCPTransportInterface::bind_socket(
std::shared_ptr<TCPChannelResource>& channel)
{
Expand Down

0 comments on commit 281c046

Please sign in to comment.