Prepare make ThreadPool of HTTPServer public available
parent
89f748cea4
commit
89dddbc07b
|
@ -39,6 +39,7 @@ namespace ln.http
|
|||
Dictionary<TcpListener, Thread> currentListenerThreads = new Dictionary<TcpListener, Thread>();
|
||||
|
||||
DynamicPool threadPool;
|
||||
public DynamicPool ThreadPool => threadPool;
|
||||
|
||||
public HTTPServer()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@ namespace ln.http
|
|||
Dictionary<String, String> requestHeaders;
|
||||
Dictionary<String, String> requestCookies;
|
||||
|
||||
public IPEndPoint RemoteEndpoint { get; private set; }
|
||||
public HTTPServer HTTPServer { get; }
|
||||
|
||||
public IPEndPoint RemoteEndpoint { get; private set; }
|
||||
public IPEndPoint LocalEndpoint { get; private set; }
|
||||
|
||||
public Uri BaseURI { get; 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;
|
||||
|
@ -75,7 +78,7 @@ namespace ln.http
|
|||
{
|
||||
int nread = httpReader.ReadRequestBody(requestBody, 0, clength);
|
||||
if (nread != clength)
|
||||
throw new HttpException(500,"failed to read request content");
|
||||
throw new HttpException(500, "failed to read request content");
|
||||
}
|
||||
|
||||
ContentStream = new MemoryStream(requestBody);
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace ln.http.websocket
|
|||
|
||||
public class WebSocket
|
||||
{
|
||||
public HTTPServer HTTPServer => HttpRequest.HTTPServer;
|
||||
public HttpRequest HttpRequest { get; }
|
||||
public Stream Stream { get; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue