diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2019-04-24 19:19:18 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-05-02 03:37:45 +0300 |
commit | ae29b8c4d22fddb9f17610f87d27b53c95509e7c (patch) | |
tree | 5d01a7b1e328ead214f719dc6de1f70929dde049 /crow | |
parent | 7bffdb7e9da69ae5416cda8df826372c33716beb (diff) | |
download | bmcweb-ae29b8c4d22fddb9f17610f87d27b53c95509e7c.tar.xz |
bmcweb: /s/boost::beast::string_view/std::string_view/g
Follow-on to https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/18891
Tested: Checked that the host console and virtual media endpoints
still worked as expected.
Change-Id: Ifdc5f21f3668bdf9bd24189504aaeb17b232c921
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'crow')
-rw-r--r-- | crow/include/crow/websocket.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/crow/include/crow/websocket.h b/crow/include/crow/websocket.h index 239e16b5a9..f46147743a 100644 --- a/crow/include/crow/websocket.h +++ b/crow/include/crow/websocket.h @@ -21,11 +21,11 @@ struct Connection : std::enable_shared_from_this<Connection> explicit Connection(const crow::Request& req) : req(req), userdataPtr(nullptr){}; - virtual void sendBinary(const boost::beast::string_view msg) = 0; + virtual void sendBinary(const std::string_view msg) = 0; virtual void sendBinary(std::string&& msg) = 0; - virtual void sendText(const boost::beast::string_view msg) = 0; + virtual void sendText(const std::string_view msg) = 0; virtual void sendText(std::string&& msg) = 0; - virtual void close(const boost::beast::string_view msg = "quit") = 0; + virtual void close(const std::string_view msg = "quit") = 0; virtual boost::asio::io_context& get_io_context() = 0; virtual ~Connection() = default; @@ -97,7 +97,7 @@ template <typename Adaptor> class ConnectionImpl : public Connection }); } - void sendBinary(const boost::beast::string_view msg) override + void sendBinary(const std::string_view msg) override { ws.binary(true); outBuffer.emplace_back(msg); @@ -111,7 +111,7 @@ template <typename Adaptor> class ConnectionImpl : public Connection doWrite(); } - void sendText(const boost::beast::string_view msg) override + void sendText(const std::string_view msg) override { ws.text(true); outBuffer.emplace_back(msg); @@ -125,7 +125,7 @@ template <typename Adaptor> class ConnectionImpl : public Connection doWrite(); } - void close(const boost::beast::string_view msg) override + void close(const std::string_view msg) override { ws.async_close( boost::beast::websocket::close_code::normal, @@ -155,30 +155,30 @@ template <typename Adaptor> class ConnectionImpl : public Connection void doRead() { - ws.async_read( - inBuffer, [this, self(shared_from_this())]( + ws.async_read(inBuffer, + [this, self(shared_from_this())]( boost::beast::error_code ec, std::size_t bytes_read) { - if (ec) - { - if (ec != boost::beast::websocket::error::closed) - { - BMCWEB_LOG_ERROR << "doRead error " << ec; - } - if (closeHandler) - { - boost::beast::string_view reason = ws.reason().reason; - closeHandler(*this, std::string(reason)); - } - return; - } - if (messageHandler) - { - messageHandler(*this, inString, ws.got_text()); - } - inBuffer.consume(bytes_read); - inString.clear(); - doRead(); - }); + if (ec) + { + if (ec != boost::beast::websocket::error::closed) + { + BMCWEB_LOG_ERROR << "doRead error " << ec; + } + if (closeHandler) + { + std::string_view reason = ws.reason().reason; + closeHandler(*this, std::string(reason)); + } + return; + } + if (messageHandler) + { + messageHandler(*this, inString, ws.got_text()); + } + inBuffer.consume(bytes_read); + inString.clear(); + doRead(); + }); } void doWrite() |