crow
crow copied to clipboard
crash on close websocket in onmessage()/onopen() function
crash on close websocket in onmessage()/onopen() function.
CROW_ROUTE(app, "/")
.websocket()
.onopen([&](crow::websocket::connection& conn) {
CROW_LOG_INFO << "new websocket connection";
std::lock_guard<std::mutex> _(mtx);
conn.close();
})
.onmessage([&](crow::websocket::connection& conn, const std::string& data, bool is_binary) {
std::lock_guard<std::mutex> _(mtx);
conn.close();
});
I got error _Left is 0xDDDDDDDD。
adaptor_.close();
close_connection_ = true;
if (!is_close_handler_called_)
{
if (close_handler_)
close_handler_(*this, fragment_);
is_close_handler_called_ = true;
}
check_destroy();
}
}
break;
case 0x9: // Ping
{
send_pong(fragment_);
}
break;
case 0xA: // Pong
{
pong_received_ = true;
}
break;
}
fragment_.clear();
}
break on websocekt.h
line 451, fragment_.clear();
because class Connection already delete , but called fragment_.clear();
I'm using VS 2015 on Windows.
This problem also happened in MacOS, Apple LLVM version 9.1.0 (clang-902.0.39.2).