From 08a9a2eca9ae71244065a960c7ff3f62bc9d0456 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 19 Oct 2016 23:17:43 +0900 Subject: [PATCH] asio: Fix bug when end() is called outside nghttp2 callback --- src/asio_server_http2_handler.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/asio_server_http2_handler.cc b/src/asio_server_http2_handler.cc index bcc9d393..bda3634f 100644 --- a/src/asio_server_http2_handler.cc +++ b/src/asio_server_http2_handler.cc @@ -404,7 +404,8 @@ void http2_handler::stream_error(int32_t stream_id, uint32_t error_code) { void http2_handler::signal_write() { if (!inside_callback_) { - initiate_write(); + auto self = shared_from_this(); + io_service_.post([self]() { self->initiate_write(); }); } }