This commit is contained in:
noosc 2022-11-01 05:21:13 +09:00 committed by GitHub
commit 0c058e10f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -87,10 +87,15 @@ public:
/// Start the first asynchronous operation for the connection.
void start() {
boost::system::error_code ec;
std::weak_ptr<connection> weak_self = this->shared_from_this();
handler_ = std::make_shared<http2_handler>(
GET_IO_SERVICE(socket_), socket_.lowest_layer().remote_endpoint(ec),
[this]() { do_write(); }, mux_);
[weak_self]() {
auto shared_connection = weak_self.lock();
if (!shared_connection) { return; }
shared_connection->do_write();
}, mux_);
if (handler_->start() != 0) {
stop();
return;