cosmetics
parent
6ba5b78851
commit
fe7d9625aa
|
@ -121,8 +121,7 @@ namespace OSHttpServer
|
||||||
SocketError disconnectError = SocketError.HostDown;
|
SocketError disconnectError = SocketError.HostDown;
|
||||||
for (int i = 0; i < m_contexts.Count; i++)
|
for (int i = 0; i < m_contexts.Count; i++)
|
||||||
{
|
{
|
||||||
HttpClientContext context = null;
|
if (m_contexts.TryDequeue(out HttpClientContext context))
|
||||||
if (m_contexts.TryDequeue(out context))
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,11 +91,6 @@ namespace OSHttpServer
|
||||||
|
|
||||||
public bool StopMonitoring;
|
public bool StopMonitoring;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Context have been started (a new client have connected)
|
|
||||||
/// </summary>
|
|
||||||
public event EventHandler Started;
|
|
||||||
|
|
||||||
public IPEndPoint LocalIPEndPoint {get; set;}
|
public IPEndPoint LocalIPEndPoint {get; set;}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -213,8 +208,8 @@ namespace OSHttpServer
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
{
|
{
|
||||||
ReceiveLoop();
|
Task tk = new Task(() => ReceiveLoop());
|
||||||
Started?.Invoke(this, EventArgs.Empty);
|
tk.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -488,7 +483,6 @@ namespace OSHttpServer
|
||||||
m_waitingResponse = true;
|
m_waitingResponse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for now pipeline requests need to be serialized by opensim
|
|
||||||
if(donow)
|
if(donow)
|
||||||
RequestReceived?.Invoke(this, new RequestEventArgs(m_currentRequest));
|
RequestReceived?.Invoke(this, new RequestEventArgs(m_currentRequest));
|
||||||
|
|
||||||
|
@ -530,9 +524,14 @@ namespace OSHttpServer
|
||||||
isSendingResponse = false;
|
isSendingResponse = false;
|
||||||
m_currentResponse?.Clear();
|
m_currentResponse?.Clear();
|
||||||
m_currentResponse = null;
|
m_currentResponse = null;
|
||||||
|
lock (m_requestsLock)
|
||||||
|
m_waitingResponse = false;
|
||||||
|
|
||||||
|
if(contextID < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
bool doclose = ctype == ConnectionType.Close;
|
bool doclose = ctype == ConnectionType.Close;
|
||||||
if (doclose)
|
if (doclose)
|
||||||
{
|
{
|
||||||
m_isClosing = true;
|
m_isClosing = true;
|
||||||
m_requests.Clear();
|
m_requests.Clear();
|
||||||
|
@ -559,19 +558,16 @@ namespace OSHttpServer
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TriggerKeepalive = true;
|
TriggerKeepalive = true;
|
||||||
|
HttpRequest nextRequest = null;
|
||||||
lock (m_requestsLock)
|
lock (m_requestsLock)
|
||||||
{
|
{
|
||||||
m_waitingResponse = false;
|
|
||||||
if (m_requests != null && m_requests.Count > 0)
|
if (m_requests != null && m_requests.Count > 0)
|
||||||
{
|
nextRequest = m_requests.Dequeue();
|
||||||
HttpRequest nextRequest = m_requests.Dequeue();
|
if (nextRequest != null && RequestReceived != null)
|
||||||
if (nextRequest != null)
|
m_waitingResponse = true;
|
||||||
{
|
|
||||||
m_waitingResponse = true;
|
|
||||||
RequestReceived?.Invoke(this, new RequestEventArgs(nextRequest));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (nextRequest != null)
|
||||||
|
RequestReceived?.Invoke(this, new RequestEventArgs(nextRequest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue