clean a few more things before giving a socket to websockets. (this would happen later anyway)

master
UbitUmarov 2020-05-09 00:16:01 +01:00
parent ea11f1aeb8
commit a367828a85
1 changed files with 15 additions and 0 deletions

View File

@ -719,6 +719,21 @@ namespace OSHttpServer
m_parser.BodyBytesReceived -= OnBodyBytesReceived;
m_parser.Clear();
m_currentRequest?.Clear();
m_currentRequest = null;
m_currentResponse?.Clear();
m_currentResponse = null;
if (m_requests != null)
{
while (m_requests.Count > 0)
{
HttpRequest req = m_requests.Dequeue();
req.Clear();
}
}
m_requests.Clear();
m_requests = null;
return new HTTPNetworkContext() { Socket = m_sock, Stream = m_stream as NetworkStream };
}