Examples use flat_buffer

fix #1488
This commit is contained in:
Vinnie Falco
2019-03-01 11:57:58 -08:00
parent 7806672f42
commit 272b6f23e4
17 changed files with 19 additions and 18 deletions

View File

@ -2,6 +2,7 @@ Version 225:
* Tidy up an unused function * Tidy up an unused function
* Fix wsload jamfile * Fix wsload jamfile
* Examples use flat_buffer
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -47,7 +47,7 @@ class session : public std::enable_shared_from_this<session>
tcp::resolver resolver_; tcp::resolver resolver_;
websocket::stream< websocket::stream<
beast::ssl_stream<beast::tcp_stream>> ws_; beast::ssl_stream<beast::tcp_stream>> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
std::string host_; std::string host_;
std::string text_; std::string text_;

View File

@ -41,7 +41,7 @@ class session : public std::enable_shared_from_this<session>
{ {
tcp::resolver resolver_; tcp::resolver resolver_;
websocket::stream<beast::tcp_stream> ws_; websocket::stream<beast::tcp_stream> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
std::string host_; std::string host_;
std::string text_; std::string text_;

View File

@ -108,7 +108,7 @@ do_session(
return fail(ec, "write"); return fail(ec, "write");
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message into our buffer // Read a message into our buffer
ws.async_read(buffer, yield[ec]); ws.async_read(buffer, yield[ec]);

View File

@ -93,7 +93,7 @@ do_session(
return fail(ec, "write"); return fail(ec, "write");
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message into our buffer // Read a message into our buffer
ws.async_read(buffer, yield[ec]); ws.async_read(buffer, yield[ec]);

View File

@ -89,7 +89,7 @@ int main(int argc, char** argv)
ws.write(net::buffer(std::string(text))); ws.write(net::buffer(std::string(text)));
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message into our buffer // Read a message into our buffer
ws.read(buffer); ws.read(buffer);

View File

@ -76,7 +76,7 @@ int main(int argc, char** argv)
ws.write(net::buffer(std::string(text))); ws.write(net::buffer(std::string(text)));
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message into our buffer // Read a message into our buffer
ws.read(buffer); ws.read(buffer);

View File

@ -50,7 +50,7 @@ class session : public std::enable_shared_from_this<session>
{ {
websocket::stream< websocket::stream<
beast::ssl_stream<beast::tcp_stream>> ws_; beast::ssl_stream<beast::tcp_stream>> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
public: public:
// Take ownership of the socket // Take ownership of the socket

View File

@ -44,7 +44,7 @@ fail(beast::error_code ec, char const* what)
class session : public std::enable_shared_from_this<session> class session : public std::enable_shared_from_this<session>
{ {
websocket::stream<beast::tcp_stream> ws_; websocket::stream<beast::tcp_stream> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
public: public:
// Take ownership of the socket // Take ownership of the socket

View File

@ -88,7 +88,7 @@ do_session(
for(;;) for(;;)
{ {
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message // Read a message
ws.async_read(buffer, yield[ec]); ws.async_read(buffer, yield[ec]);

View File

@ -70,7 +70,7 @@ do_session(
for(;;) for(;;)
{ {
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message // Read a message
ws.async_read(buffer, yield[ec]); ws.async_read(buffer, yield[ec]);

View File

@ -99,7 +99,7 @@ do_sync_session(websocket::stream<beast::tcp_stream>& ws)
for(;;) for(;;)
{ {
beast::multi_buffer buffer; beast::flat_buffer buffer;
ws.read(buffer, ec); ws.read(buffer, ec);
if(ec == websocket::error::closed) if(ec == websocket::error::closed)
@ -141,7 +141,7 @@ do_sync_listen(
class async_session : public std::enable_shared_from_this<async_session> class async_session : public std::enable_shared_from_this<async_session>
{ {
websocket::stream<beast::tcp_stream> ws_; websocket::stream<beast::tcp_stream> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
public: public:
// Take ownership of the socket // Take ownership of the socket
@ -355,7 +355,7 @@ do_coro_session(
for(;;) for(;;)
{ {
beast::multi_buffer buffer; beast::flat_buffer buffer;
ws.async_read(buffer, yield[ec]); ws.async_read(buffer, yield[ec]);
if(ec == websocket::error::closed) if(ec == websocket::error::closed)

View File

@ -52,7 +52,7 @@ class session
, public std::enable_shared_from_this<session> , public std::enable_shared_from_this<session>
{ {
websocket::stream<beast::ssl_stream<beast::tcp_stream>> ws_; websocket::stream<beast::ssl_stream<beast::tcp_stream>> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
public: public:
// Take ownership of the socket // Take ownership of the socket

View File

@ -47,7 +47,7 @@ class session
, public std::enable_shared_from_this<session> , public std::enable_shared_from_this<session>
{ {
websocket::stream<beast::tcp_stream> ws_; websocket::stream<beast::tcp_stream> ws_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
public: public:
// Take ownership of the socket // Take ownership of the socket

View File

@ -63,7 +63,7 @@ do_session(tcp::socket& socket, ssl::context& ctx)
for(;;) for(;;)
{ {
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message // Read a message
ws.read(buffer); ws.read(buffer);

View File

@ -54,7 +54,7 @@ do_session(tcp::socket& socket)
for(;;) for(;;)
{ {
// This buffer will hold the incoming message // This buffer will hold the incoming message
beast::multi_buffer buffer; beast::flat_buffer buffer;
// Read a message // Read a message
ws.read(buffer); ws.read(buffer);

View File

@ -115,7 +115,7 @@ class connection
test_buffer const& tb_; test_buffer const& tb_;
net::strand< net::strand<
net::io_context::executor_type> strand_; net::io_context::executor_type> strand_;
beast::multi_buffer buffer_; beast::flat_buffer buffer_;
std::mt19937_64 rng_; std::mt19937_64 rng_;
std::size_t count_ = 0; std::size_t count_ = 0;
std::size_t bytes_ = 0; std::size_t bytes_ = 0;