From ae29b8c4d22fddb9f17610f87d27b53c95509e7c Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Wed, 24 Apr 2019 11:19:18 -0500 Subject: 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 --- crow/include/crow/websocket.h | 58 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'crow') 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 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 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 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 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 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() -- cgit v1.2.3