I found some mistakes, let me fix them.

>class Router
>{
> // std::map<int , co_event> m_cancellation;
std::map<int , async> m_cancellation;
> > > awaitable<int> handle_message(session& sess) > { > auto& cancel = m_cancellation[sess->Id()]; > defer(m_cancellation.erase(sess->id()); > > > auto client = co_await g_client_pool.get(); > defer(client.release(client)); > > > co_task _task; > auto request_id = _task << [](auto& client) -> awaitable<void> > {
> // auto r = client.request(...);
auto r = co_await client.request(...);
> if (r == INVALID) > { > LOG(...); > } > }(client); > > > auto cancel_id = _task << [](auto& cancel) -> awaitable<void> > { > co_await cancel.suspend(); > }(cancel); > > > auto ret_id = co_await _task.wait(); > if (ret_id == cancel_id) > { > LOG("cancel"); > co_return INVALID; > } > > > LOG("success");
> // return 0;
co_return 0;
> } > void cancel(int id) > { > if (auto it = m_cancellation.find(id); it != m_cancellation.end()) > { > it->second.resume(); > } > } >}; >