Prepare make ThreadPool of HTTPServer public available

master
Harald Wolff 2019-10-18 12:31:41 +02:00
parent 89f748cea4
commit 89dddbc07b
4 changed files with 9 additions and 4 deletions

View File

@ -39,6 +39,7 @@ namespace ln.http
Dictionary<TcpListener, Thread> currentListenerThreads = new Dictionary<TcpListener, Thread>();
DynamicPool threadPool;
public DynamicPool ThreadPool => threadPool;
public HTTPServer()
{

View File

@ -64,7 +64,7 @@ namespace ln.http
HttpResponse response = null;
using (CurrentRequest = new HttpRequest(httpReader, (IPEndPoint)TcpClient.Client.LocalEndPoint))
using (CurrentRequest = new HttpRequest(this.HTTPServer,httpReader, (IPEndPoint)TcpClient.Client.LocalEndPoint))
{
CurrentRequest.ApplySession(HTTPServer.SessionCache);

View File

@ -15,6 +15,8 @@ namespace ln.http
Dictionary<String, String> requestHeaders;
Dictionary<String, String> requestCookies;
public HTTPServer HTTPServer { get; }
public IPEndPoint RemoteEndpoint { get; private set; }
public IPEndPoint LocalEndpoint { get; private set; }
@ -52,8 +54,9 @@ namespace ln.http
byte[] requestBody;
Stream connectionStream;
public HttpRequest(HttpReader httpReader,IPEndPoint localEndpoint)
public HttpRequest(HTTPServer httpServer, HttpReader httpReader, IPEndPoint localEndpoint)
{
HTTPServer = httpServer;
connectionStream = httpReader.Stream;
LocalEndpoint = localEndpoint;

View File

@ -34,6 +34,7 @@ namespace ln.http.websocket
public class WebSocket
{
public HTTPServer HTTPServer => HttpRequest.HTTPServer;
public HttpRequest HttpRequest { get; }
public Stream Stream { get; }