wasSharpNET – Diff between revs 11 and 15
?pathlinks?
Rev 11 | Rev 15 | |||
---|---|---|---|---|
Line 9... | Line 9... | |||
9 | using System.Net; |
9 | using System.Net; |
|
10 | using System.Threading; |
10 | using System.Threading; |
|
Line 11... | Line 11... | |||
11 | |
11 | |
|
12 | namespace wasSharpNET.Network.HTTP |
12 | namespace wasSharpNET.Network.HTTP |
|
13 | { |
13 | { |
|
14 | public abstract class HTTPServer |
14 | public abstract class HTTPServer : IDisposable |
|
15 | { |
15 | { |
|
Line 16... | Line 16... | |||
16 | private int activeRequests; |
16 | private int activeRequests; |
|
17 | |
17 | |
|
18 | private readonly HttpListener HTTPListener = new HttpListener() |
18 | private HttpListener HTTPListener = new HttpListener() |
|
19 | { |
19 | { |
|
Line 20... | Line 20... | |||
20 | AuthenticationSchemes = AuthenticationSchemes.None |
20 | AuthenticationSchemes = AuthenticationSchemes.None |
|
Line 21... | Line 21... | |||
21 | }; |
21 | }; |
|
22 | |
22 | |
|
Line 23... | Line 23... | |||
23 | private int processedRequests; |
23 | private int processedRequests; |
|
24 | |
24 | |
|
25 | private readonly AutoResetEvent StopServerEvent = new AutoResetEvent(false); |
25 | private AutoResetEvent StopServerEvent = new AutoResetEvent(false); |
|
26 | private readonly AutoResetEvent ServerStoppedEvent = new AutoResetEvent(false); |
26 | private AutoResetEvent ServerStoppedEvent = new AutoResetEvent(false); |
|
Line 120... | Line 120... | |||
120 | { |
120 | { |
|
121 | Interlocked.Decrement(ref activeRequests); |
121 | Interlocked.Decrement(ref activeRequests); |
|
122 | } |
122 | } |
|
123 | } |
123 | } |
|
Line -... | Line 124... | |||
- | 124 | |
||
- | 125 | public void Dispose() |
||
- | 126 | { |
||
- | 127 | Stop(); |
||
- | 128 | |
||
- | 129 | HTTPListener = null; |
||
- | 130 | StopServerEvent?.Dispose(); |
||
- | 131 | ServerStoppedEvent?.Dispose(); |
||
- | 132 | |
||
- | 133 | StopServerEvent = null; |
||
- | 134 | ServerStoppedEvent = null; |
||
- | 135 | } |
||
124 | |
136 | |
|
125 | private class HTTPServerCallbackState |
137 | private class HTTPServerCallbackState |
|
126 | { |
138 | { |
|
127 | public HTTPServerCallbackState(HttpListener listener) |
139 | public HTTPServerCallbackState(HttpListener listener) |
|
128 | { |
140 | { |