forked from boostorg/beast
Remove session_alloc (API Change)
* session_alloc is removed, as it does not improve performance as intended. Actions Required: * Don't use session_alloc
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include <example/common/session_alloc.hpp>
|
||||
|
||||
#include <boost/beast/core.hpp>
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#include <boost/beast/_experimental/unit_test/dstream.hpp>
|
||||
@@ -119,7 +117,6 @@ class connection
|
||||
std::mt19937_64 rng_;
|
||||
std::size_t count_ = 0;
|
||||
std::size_t bytes_ = 0;
|
||||
session_alloc<char> alloc_;
|
||||
|
||||
public:
|
||||
connection(
|
||||
@@ -153,9 +150,9 @@ public:
|
||||
run()
|
||||
{
|
||||
ws_.next_layer().async_connect(ep_,
|
||||
alloc_.wrap(beast::bind_front_handler(
|
||||
beast::bind_front_handler(
|
||||
&connection::on_connect,
|
||||
this->shared_from_this())));
|
||||
this->shared_from_this()));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -168,9 +165,9 @@ private:
|
||||
ws_.async_handshake(
|
||||
ep_.address().to_string() + ":" + std::to_string(ep_.port()),
|
||||
"/",
|
||||
alloc_.wrap(beast::bind_front_handler(
|
||||
beast::bind_front_handler(
|
||||
&connection::on_handshake,
|
||||
this->shared_from_this())));
|
||||
this->shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -189,9 +186,9 @@ private:
|
||||
double(4) / beast::buffer_size(tb_)};
|
||||
ws_.async_write_some(true,
|
||||
beast::buffers_prefix(dist(rng_), tb_),
|
||||
alloc_.wrap(beast::bind_front_handler(
|
||||
beast::bind_front_handler(
|
||||
&connection::on_write,
|
||||
this->shared_from_this())));
|
||||
this->shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -204,18 +201,18 @@ private:
|
||||
return do_read();
|
||||
|
||||
ws_.async_close({},
|
||||
alloc_.wrap(beast::bind_front_handler(
|
||||
beast::bind_front_handler(
|
||||
&connection::on_close,
|
||||
this->shared_from_this())));
|
||||
this->shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
do_read()
|
||||
{
|
||||
ws_.async_read(buffer_,
|
||||
alloc_.wrap(beast::bind_front_handler(
|
||||
beast::bind_front_handler(
|
||||
&connection::on_read,
|
||||
this->shared_from_this())));
|
||||
this->shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -20,7 +20,6 @@ add_executable (tests-example-common
|
||||
Jamfile
|
||||
root_certificates.cpp
|
||||
server_certificate.cpp
|
||||
session_alloc.cpp
|
||||
)
|
||||
|
||||
set_property(TARGET tests-example-common PROPERTY FOLDER "tests")
|
||||
@@ -10,7 +10,6 @@
|
||||
local SOURCES =
|
||||
root_certificates.cpp
|
||||
server_certificate.cpp
|
||||
session_alloc.cpp
|
||||
;
|
||||
|
||||
local RUN_TESTS ;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Official repository: https://github.com/boostorg/beast
|
||||
//
|
||||
|
||||
// Test that header file is self-contained.
|
||||
#include "example/common/session_alloc.hpp"
|
||||
|
||||
Reference in New Issue
Block a user