diff options
| author | Stefan Boberg <[email protected]> | 2023-05-15 18:07:45 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2023-05-15 18:07:45 +0200 |
| commit | 06aaf561fed3db1eed2a044180895957de87ed20 (patch) | |
| tree | c80ef0d23b77ea251904c9f05a0626ef6fdc3a78 /src/zenhttp/httpsys.cpp | |
| parent | implemented string conversion for CbValidateError enum (diff) | |
| parent | Remove ATL header usage (#306) (diff) | |
| download | zen-06aaf561fed3db1eed2a044180895957de87ed20.tar.xz zen-06aaf561fed3db1eed2a044180895957de87ed20.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'src/zenhttp/httpsys.cpp')
| -rw-r--r-- | src/zenhttp/httpsys.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/zenhttp/httpsys.cpp b/src/zenhttp/httpsys.cpp index 25e4393b3..979f69aeb 100644 --- a/src/zenhttp/httpsys.cpp +++ b/src/zenhttp/httpsys.cpp @@ -178,7 +178,7 @@ class HttpSysServerRequest : public HttpServerRequest { public: HttpSysServerRequest(HttpSysTransaction& Tx, HttpService& Service, IoBuffer PayloadBuffer); - ~HttpSysServerRequest() = default; + ~HttpSysServerRequest(); virtual Oid ParseSessionId() const override; virtual uint32_t ParseRequestId() const override; @@ -722,7 +722,7 @@ HttpSysServer::HttpSysServer(unsigned int ThreadCount, unsigned int AsyncWorkThr : m_Log(logging::Get("http")) , m_RequestLog(logging::Get("http_requests")) , m_ThreadPool(ThreadCount) -, m_AsyncWorkPool(AsyncWorkThreadCount) +, m_AsyncWorkPool(AsyncWorkThreadCount, "http_async") { ULONG Result = HttpInitialize(HTTPAPI_VERSION_2, HTTP_INITIALIZE_SERVER, nullptr); @@ -1093,6 +1093,9 @@ HttpSysTransaction::IssueInitialRequest(std::error_code& ErrorCode) m_InitialHttpHandler.IssueRequest(ErrorCode); } +thread_local bool t_IsHttpSysThreadNamed = false; +static std::atomic<int> HttpSysThreadIndex = 0; + void HttpSysTransaction::IoCompletionCallback(PTP_CALLBACK_INSTANCE Instance, PVOID pContext /* HttpSysServer */, @@ -1105,6 +1108,17 @@ HttpSysTransaction::IoCompletionCallback(PTP_CALLBACK_INSTANCE Instance, UNREFERENCED_PARAMETER(Instance); UNREFERENCED_PARAMETER(pContext); + // Assign names to threads for context + + if (!t_IsHttpSysThreadNamed) + { + t_IsHttpSysThreadNamed = true; + const int ThreadIndex = ++HttpSysThreadIndex; + zen::ExtendableStringBuilder<128> ThreadName; + ThreadName << "httpio_" << ThreadIndex; + SetCurrentThreadName(ThreadName); + } + // Note that for a given transaction we may be in this completion function on more // than one thread at any given moment. This means we need to be careful about what // happens in here @@ -1306,6 +1320,10 @@ HttpSysServerRequest::HttpSysServerRequest(HttpSysTransaction& Tx, HttpService& } } +HttpSysServerRequest::~HttpSysServerRequest() +{ +} + Oid HttpSysServerRequest::ParseSessionId() const { |