Take boost error_code by reference

By convention, we should be following boost here, and passing error_code
by reference, not by value.  This makes our code consistent, and removes
the need for a copy in some cases.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id42ea4a90b6685a84818b87d1506c11256b3b9ae
diff --git a/http/http_client.hpp b/http/http_client.hpp
index c902e1a..fff261f 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -401,7 +401,7 @@
     }
 
     static void onTimeout(const std::weak_ptr<ConnectionInfo>& weakSelf,
-                          const boost::system::error_code ec)
+                          const boost::system::error_code& ec)
     {
         if (ec == boost::asio::error::operation_aborted)
         {
diff --git a/http/http_server.hpp b/http/http_server.hpp
index cc4fc22..3949a46 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -181,7 +181,7 @@
         }
         acceptor->async_accept(
             boost::beast::get_lowest_layer(connection->socket()),
-            [this, connection](boost::system::error_code ec) {
+            [this, connection](const boost::system::error_code& ec) {
             if (!ec)
             {
                 boost::asio::post(*this->ioService,
diff --git a/http/routing.hpp b/http/routing.hpp
index ae63f05..736ec38 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -1374,7 +1374,7 @@
 
         crow::connections::systemBus->async_method_call(
             [req{std::move(req)}, asyncResp, &rule, params](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::DBusPropertiesMap& userInfoMap) mutable {
             if (ec)
             {
diff --git a/http/websocket.hpp b/http/websocket.hpp
index c36e579..f17ee5e 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -138,7 +138,7 @@
 
         // Perform the websocket upgrade
         ws.async_accept(req, [this, self(shared_from_this())](
-                                 boost::system::error_code ec) {
+                                 const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Error in ws.async_accept " << ec;
@@ -180,7 +180,7 @@
     {
         ws.async_close(
             {boost::beast::websocket::close_code::normal, msg},
-            [self(shared_from_this())](boost::system::error_code ec) {
+            [self(shared_from_this())](const boost::system::error_code& ec) {
             if (ec == boost::asio::error::operation_aborted)
             {
                 return;