File tree 2 files changed +13
-1
lines changed
src/Servers/IIS/AspNetCoreModuleV2
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 7
7
#include " iapplication.h"
8
8
#include " ntassert.h"
9
9
#include " SRWExclusiveLock.h"
10
+ #include " SRWSharedLock.h"
10
11
#include " exceptions.h"
11
12
12
13
class APPLICATION : public IAPPLICATION
@@ -21,14 +22,17 @@ class APPLICATION : public IAPPLICATION
21
22
_In_ IHttpContext *pHttpContext,
22
23
_Outptr_result_maybenull_ IREQUEST_HANDLER **pRequestHandler) override
23
24
{
24
- TraceContextScope traceScope (pHttpContext->GetTraceContext ());
25
25
*pRequestHandler = nullptr ;
26
26
27
+ SRWSharedLock stopLock (m_stateLock);
28
+
27
29
if (m_fStopCalled)
28
30
{
29
31
return S_FALSE;
30
32
}
31
33
34
+ TraceContextScope traceScope (pHttpContext->GetTraceContext ());
35
+
32
36
return CreateHandler (pHttpContext, pRequestHandler);
33
37
}
34
38
Original file line number Diff line number Diff line change @@ -68,6 +68,13 @@ IN_PROCESS_APPLICATION::StopClr()
68
68
{
69
69
shutdownHandler (m_ShutdownHandlerContext);
70
70
}
71
+
72
+ auto requestCount = m_requestCount.load ();
73
+ if (requestCount == 0 )
74
+ {
75
+ LOG_INFO (L" Drained all requests, notifying managed." );
76
+ m_RequestsDrainedHandler (m_ShutdownHandlerContext);
77
+ }
71
78
}
72
79
73
80
// Signal shutdown
@@ -537,6 +544,7 @@ IN_PROCESS_APPLICATION::CreateHandler(
537
544
void
538
545
IN_PROCESS_APPLICATION::HandleRequestCompletion ()
539
546
{
547
+ SRWSharedLock lock (m_stateLock);
540
548
auto requestCount = m_requestCount--;
541
549
if (m_fStopCalled && requestCount == 0 )
542
550
{
You can’t perform that action at this time.
0 commit comments