Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Mar 25, 2024
1 parent cdff369 commit 29ddac4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions rmf_websocket/src/rmf_websocket/client/ClientWebSocketEndpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ std::string ConnectionMetadata::debug_data() const
case ConnectionStatus::FAILED:
status_string = "Closed";
break;
default:
status_string = "Unknown";
break;
}


Expand Down Expand Up @@ -129,7 +132,8 @@ websocketpp::lib::error_code ClientWebSocketEndpoint::connect()
if (ec)
{
std::stringstream err;
err << "> Connect initialization error: " << ec.message();
err << "> Connect initialization error: " << ec.message() << std::endl
<< "> Host: " << _uri << std::endl;
_logger(err.str());
return ec;
}
Expand All @@ -138,7 +142,10 @@ websocketpp::lib::error_code ClientWebSocketEndpoint::connect()
{
// TODO(arjo) Parametrize the timeout.
using namespace std::chrono_literals;
_logger("Attempting reconnection in 1s.");
std::stringstream err;
err << "> Reconnecting in 1s" << std::endl
<< "> Host: " << _uri << std::endl;
_logger(err.str());
std::this_thread::sleep_for(1s);
connect();
};
Expand Down Expand Up @@ -228,7 +235,8 @@ ClientWebSocketEndpoint::~ClientWebSocketEndpoint()
if (ec)
{
std::stringstream err;
err << "> Error closing connection : " << ec.message();
err << "> Error closing connection : " << ec.message() << std::endl
<< "> Host: " << _uri << std::endl;
_logger(err.str());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ class ClientWebSocketEndpoint
ConnectionCallback _connection_cb;
};
}
#endif
#endif

0 comments on commit 29ddac4

Please sign in to comment.