Fix race in advanced server examples

fix #1073
This commit is contained in:
Vinnie Falco
2018-04-12 08:54:18 -07:00
parent 3c3f4fc52b
commit f1b1ee2345
3 changed files with 28 additions and 0 deletions
@@ -578,6 +578,15 @@ public:
void
run()
{
// Make sure we run on the strand
if(! strand_.running_in_this_thread())
return boost::asio::post(
boost::asio::bind_executor(
strand_,
std::bind(
&http_session::run,
shared_from_this())));
// Run the timer. The timer is operated
// continuously, this simplifies the code.
on_timer({});