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>
diff --git a/crow/include/crow/websocket.h b/crow/include/crow/websocket.h
index 239e16b..f461477 100644
--- a/crow/include/crow/websocket.h
+++ b/crow/include/crow/websocket.h
@@ -21,11 +21,11 @@
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 @@
});
}
- 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 @@
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 @@
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 @@
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()