wasSharpNET
/Network/HTTP/HTTPServer.cs |
@@ -11,11 +11,11 @@ |
|
namespace wasSharpNET.Network.HTTP |
{ |
public abstract class HTTPServer |
public abstract class HTTPServer : IDisposable |
{ |
private int activeRequests; |
|
private readonly HttpListener HTTPListener = new HttpListener() |
private HttpListener HTTPListener = new HttpListener() |
{ |
AuthenticationSchemes = AuthenticationSchemes.None |
}; |
@@ -22,8 +22,8 @@ |
|
private int processedRequests; |
|
private readonly AutoResetEvent StopServerEvent = new AutoResetEvent(false); |
private readonly AutoResetEvent ServerStoppedEvent = new AutoResetEvent(false); |
private AutoResetEvent StopServerEvent = new AutoResetEvent(false); |
private AutoResetEvent ServerStoppedEvent = new AutoResetEvent(false); |
|
public AuthenticationSchemes AuthenticationSchemes |
{ |
@@ -122,6 +122,18 @@ |
} |
} |
|
public void Dispose() |
{ |
Stop(); |
|
HTTPListener = null; |
StopServerEvent?.Dispose(); |
ServerStoppedEvent?.Dispose(); |
|
StopServerEvent = null; |
ServerStoppedEvent = null; |
} |
|
private class HTTPServerCallbackState |
{ |
public HTTPServerCallbackState(HttpListener listener) |