mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd::client: Reference the client's request handling context via class member.
This commit is contained in:
parent
414133ba55
commit
69aeddad61
2 changed files with 10 additions and 0 deletions
|
@ -48,6 +48,7 @@ struct ircd::client
|
|||
unique_buffer<mutable_buffer> head_buffer;
|
||||
unique_buffer<mutable_buffer> content_buffer;
|
||||
std::shared_ptr<socket> sock;
|
||||
ctx::ctx *reqctx {nullptr};
|
||||
ircd::timer timer;
|
||||
size_t head_length {0};
|
||||
size_t content_consumed {0};
|
||||
|
|
|
@ -328,6 +328,15 @@ void
|
|||
ircd::handle_client_request(std::shared_ptr<client> client)
|
||||
noexcept try
|
||||
{
|
||||
// The ircd::ctx now handling this request is referenced and accessible
|
||||
// in client for the duration of this handling.
|
||||
client->reqctx = ctx::current;
|
||||
const unwind reset{[&client]
|
||||
{
|
||||
assert(bool(client));
|
||||
client->reqctx = nullptr;
|
||||
}};
|
||||
|
||||
if(client->main())
|
||||
client->async();
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue