summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-05-18 20:30:34 +0300
committerEd Tanous <ed@tanous.net>2023-05-19 20:47:39 +0300
commit81c4e3305281b2cfece8822f7c7114200ce4e12c (patch)
tree60563dba369c24a57bbcc21f6a172490e338a3f2
parent4a40441f944aaff8d7bb2040e4d88ebfcebbab11 (diff)
downloadbmcweb-81c4e3305281b2cfece8822f7c7114200ce4e12c.tar.xz
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
-rw-r--r--http/http_client.hpp6
-rw-r--r--http/http_connection.hpp2
-rw-r--r--include/obmc_console.hpp2
-rw-r--r--include/vm_websocket.hpp2
-rw-r--r--redfish-core/include/server_sent_events.hpp2
-rw-r--r--redfish-core/lib/aggregation_service.hpp4
-rw-r--r--redfish-core/lib/systems.hpp2
-rw-r--r--redfish-core/lib/update_service.hpp2
8 files changed, 11 insertions, 11 deletions
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 8161eb1c5f..2b498b7fb8 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -169,7 +169,7 @@ class ConnectionInfo : public std::enable_shared_from_this<ConnectionInfo>
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 @@ class ConnectionInfo : public std::enable_shared_from_this<ConnectionInfo>
}
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 @@ class ConnectionInfo : public std::enable_shared_from_this<ConnectionInfo>
}
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 213960214f..7b66ac851b 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -602,7 +602,7 @@ class Connection :
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 =
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 3ab13ee4c2..fac489ad6d 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -50,7 +50,7 @@ inline void doWrite()
doingWrite = true;
hostSocket->async_write_some(
boost::asio::buffer(inputBuffer.data(), inputBuffer.size()),
- [](boost::beast::error_code ec, std::size_t bytesWritten) {
+ [](const boost::beast::error_code& ec, std::size_t bytesWritten) {
doingWrite = false;
inputBuffer.erase(0, bytesWritten);
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index 89270d90fb..fed36815d8 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -90,7 +90,7 @@ class Handler : public std::enable_shared_from_this<Handler>
doingWrite = true;
pipeIn.async_write_some(
inputBuffer->data(),
- [this, self(shared_from_this())](boost::beast::error_code ec,
+ [this, self(shared_from_this())](const boost::beast::error_code& ec,
std::size_t bytesWritten) {
BMCWEB_LOG_DEBUG << "Wrote " << bytesWritten << "bytes";
doingWrite = false;
diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp
index 1592d507a1..695c483b68 100644
--- a/redfish-core/include/server_sent_events.hpp
+++ b/redfish-core/include/server_sent_events.hpp
@@ -113,7 +113,7 @@ class ServerSentEvents : public std::enable_shared_from_this<ServerSentEvents>
sseConn->async_write_some(
boost::asio::buffer(outBuffer.data(), outBuffer.size()),
[self(shared_from_this())](
- boost::beast::error_code ec,
+ const boost::beast::error_code& ec,
[[maybe_unused]] const std::size_t& bytesTransferred) {
self->outBuffer.erase(0, bytesTransferred);
diff --git a/redfish-core/lib/aggregation_service.hpp b/redfish-core/lib/aggregation_service.hpp
index 9874d14edf..6c93613a34 100644
--- a/redfish-core/lib/aggregation_service.hpp
+++ b/redfish-core/lib/aggregation_service.hpp
@@ -66,7 +66,7 @@ inline void requestRoutesAggregationService(App& app)
inline void populateAggregationSourceCollection(
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const std::unordered_map<std::string, boost::urls::url>& satelliteInfo)
{
// Something went wrong while querying dbus
@@ -138,7 +138,7 @@ inline void requestRoutesAggregationSourceCollection(App& app)
inline void populateAggregationSource(
const std::string& aggregationSourceId,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const boost::system::error_code ec,
+ const boost::system::error_code& ec,
const std::unordered_map<std::string, boost::urls::url>& satelliteInfo)
{
asyncResp->res.addHeader(
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 736b15850e..1cedf2d38d 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2974,7 +2974,7 @@ inline void afterPortRequest(
if (protocolName == "SSH")
{
getPortNumber(socketPath, [asyncResp, protocolName](
- const boost::system::error_code ec1,
+ const boost::system::error_code& ec1,
int portNumber) {
if (ec1)
{
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 7c8ce01a01..ddb46f6be0 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -575,7 +575,7 @@ inline void setApplyTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
// Set the requested image apply time value
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec) {
+ [asyncResp](const boost::system::error_code& ec) {
if (ec)
{
BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;