mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 13:27:33 +02:00
@@ -3,6 +3,7 @@ Version XXX:
|
|||||||
* Remove CODE_OF_CONDUCT.md
|
* Remove CODE_OF_CONDUCT.md
|
||||||
* Refactor websocket read
|
* Refactor websocket read
|
||||||
* Correct buffer_bytes documentation
|
* Correct buffer_bytes documentation
|
||||||
|
* Fix examples to dispatch to strand
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include <boost/beast/websocket.hpp>
|
#include <boost/beast/websocket.hpp>
|
||||||
#include <boost/beast/version.hpp>
|
#include <boost/beast/version.hpp>
|
||||||
#include <boost/asio/bind_executor.hpp>
|
#include <boost/asio/bind_executor.hpp>
|
||||||
|
#include <boost/asio/dispatch.hpp>
|
||||||
#include <boost/asio/signal_set.hpp>
|
#include <boost/asio/signal_set.hpp>
|
||||||
#include <boost/asio/steady_timer.hpp>
|
#include <boost/asio/steady_timer.hpp>
|
||||||
#include <boost/asio/strand.hpp>
|
#include <boost/asio/strand.hpp>
|
||||||
@@ -817,6 +818,20 @@ public:
|
|||||||
// Launch the detector
|
// Launch the detector
|
||||||
void
|
void
|
||||||
run()
|
run()
|
||||||
|
{
|
||||||
|
// We need to be executing within a strand to perform async operations
|
||||||
|
// on the I/O objects in this session. Although not strictly necessary
|
||||||
|
// for single-threaded contexts, this example code is written to be
|
||||||
|
// thread-safe by default.
|
||||||
|
net::dispatch(
|
||||||
|
stream_.get_executor(),
|
||||||
|
beast::bind_front_handler(
|
||||||
|
&detect_session::on_run,
|
||||||
|
this->shared_from_this()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
on_run()
|
||||||
{
|
{
|
||||||
// Set the timeout.
|
// Set the timeout.
|
||||||
stream_.expires_after(std::chrono::seconds(30));
|
stream_.expires_after(std::chrono::seconds(30));
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#include <boost/beast/websocket.hpp>
|
#include <boost/beast/websocket.hpp>
|
||||||
#include <boost/beast/version.hpp>
|
#include <boost/beast/version.hpp>
|
||||||
#include <boost/asio/bind_executor.hpp>
|
#include <boost/asio/bind_executor.hpp>
|
||||||
|
#include <boost/asio/dispatch.hpp>
|
||||||
#include <boost/asio/signal_set.hpp>
|
#include <boost/asio/signal_set.hpp>
|
||||||
#include <boost/asio/strand.hpp>
|
#include <boost/asio/strand.hpp>
|
||||||
#include <boost/make_unique.hpp>
|
#include <boost/make_unique.hpp>
|
||||||
@@ -439,9 +440,18 @@ public:
|
|||||||
void
|
void
|
||||||
run()
|
run()
|
||||||
{
|
{
|
||||||
do_read();
|
// We need to be executing within a strand to perform async operations
|
||||||
|
// on the I/O objects in this session. Although not strictly necessary
|
||||||
|
// for single-threaded contexts, this example code is written to be
|
||||||
|
// thread-safe by default.
|
||||||
|
net::dispatch(
|
||||||
|
stream_.get_executor(),
|
||||||
|
beast::bind_front_handler(
|
||||||
|
&http_session::do_read,
|
||||||
|
this->shared_from_this()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void
|
void
|
||||||
do_read()
|
do_read()
|
||||||
@@ -588,7 +598,15 @@ public:
|
|||||||
void
|
void
|
||||||
run()
|
run()
|
||||||
{
|
{
|
||||||
do_accept();
|
// We need to be executing within a strand to perform async operations
|
||||||
|
// on the I/O objects in this session. Although not strictly necessary
|
||||||
|
// for single-threaded contexts, this example code is written to be
|
||||||
|
// thread-safe by default.
|
||||||
|
net::dispatch(
|
||||||
|
acceptor_.get_executor(),
|
||||||
|
beast::bind_front_handler(
|
||||||
|
&listener::do_accept,
|
||||||
|
this->shared_from_this()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user