2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
4
using System ;
5
+ using System . Diagnostics ;
5
6
using System . Runtime . InteropServices ;
6
7
using System . Threading ;
7
8
using Microsoft . AspNetCore . HttpSys . Internal ;
@@ -42,7 +43,7 @@ internal RequestQueue(UrlGroup urlGroup, string requestQueueName, RequestQueueMo
42
43
43
44
if ( _mode == RequestQueueMode . CreateOrAttach && statusCode == UnsafeNclNativeMethods . ErrorCodes . ERROR_ALREADY_EXISTS )
44
45
{
45
- // Tried to create, but it already exist so attach to it instead.
46
+ // Tried to create, but it already exists so attach to it instead.
46
47
Created = false ;
47
48
flags = HttpApiTypes . HTTP_CREATE_REQUEST_QUEUE_FLAG . OpenExisting ;
48
49
statusCode = HttpApi . HttpCreateRequestQueue (
@@ -87,7 +88,7 @@ internal RequestQueue(UrlGroup urlGroup, string requestQueueName, RequestQueueMo
87
88
}
88
89
89
90
/// <summary>
90
- /// Set true if we created queue instead of attaching to existing
91
+ /// True if this instace created the queue instead of attaching to an existing one.
91
92
/// </summary>
92
93
internal bool Created { get ; }
93
94
@@ -96,6 +97,7 @@ internal RequestQueue(UrlGroup urlGroup, string requestQueueName, RequestQueueMo
96
97
97
98
internal unsafe void AttachToUrlGroup ( )
98
99
{
100
+ Debug . Assert ( Created ) ;
99
101
CheckDisposed ( ) ;
100
102
// Set the association between request queue and url group. After this, requests for registered urls will
101
103
// get delivered to this request queue.
@@ -112,6 +114,7 @@ internal unsafe void AttachToUrlGroup()
112
114
113
115
internal unsafe void DetachFromUrlGroup ( )
114
116
{
117
+ Debug . Assert ( Created ) ;
115
118
CheckDisposed ( ) ;
116
119
// Break the association between request queue and url group. After this, requests for registered urls
117
120
// will get 503s.
@@ -132,6 +135,7 @@ internal unsafe void DetachFromUrlGroup()
132
135
// The listener must be active for this to work.
133
136
internal unsafe void SetLengthLimit ( long length )
134
137
{
138
+ Debug . Assert ( Created ) ;
135
139
CheckDisposed ( ) ;
136
140
137
141
var result = HttpApi . HttpSetRequestQueueProperty ( Handle ,
@@ -147,6 +151,7 @@ internal unsafe void SetLengthLimit(long length)
147
151
// The listener must be active for this to work.
148
152
internal unsafe void SetRejectionVerbosity ( Http503VerbosityLevel verbosity )
149
153
{
154
+ Debug . Assert ( Created ) ;
150
155
CheckDisposed ( ) ;
151
156
152
157
var result = HttpApi . HttpSetRequestQueueProperty ( Handle ,
0 commit comments