Capture all boost::system::error_codes by ref
Capturing these possibly overloaded values by reference can avoid a copy
in some cases, and it's good to be consistent.
This change was made automatically by grep/sed.
Tested: Code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iafeaca2a5dc52f39753b5a3880419d6bc943f81b
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 8161eb1..2b498b7 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -169,7 +169,7 @@
void afterResolve(
const std::shared_ptr<ConnectionInfo>& /*self*/,
- const boost::beast::error_code ec,
+ const boost::beast::error_code& ec,
const std::vector<boost::asio::ip::tcp::endpoint>& endpointList)
{
if (ec || (endpointList.empty()))
@@ -197,7 +197,7 @@
}
void afterConnect(const std::shared_ptr<ConnectionInfo>& /*self*/,
- boost::beast::error_code ec,
+ const boost::beast::error_code& ec,
const boost::asio::ip::tcp::endpoint& endpoint)
{
// The operation already timed out. We don't want do continue down
@@ -246,7 +246,7 @@
}
void afterSslHandshake(const std::shared_ptr<ConnectionInfo>& /*self*/,
- boost::beast::error_code ec)
+ const boost::beast::error_code& ec)
{
// The operation already timed out. We don't want do continue down
// this branch
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index 2139602..7b66ac8 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -602,7 +602,7 @@
std::weak_ptr<Connection<Adaptor, Handler>> weakSelf = weak_from_this();
timer.expires_after(timeout);
- timer.async_wait([weakSelf](const boost::system::error_code ec) {
+ timer.async_wait([weakSelf](const boost::system::error_code& ec) {
// Note, we are ignoring other types of errors here; If the timer
// failed for any reason, we should still close the connection
std::shared_ptr<Connection<Adaptor, Handler>> self =