risk reduncing iddle timeout again, because it is needed on current framework

master
UbitUmarov 2020-04-21 15:46:41 +01:00
parent 50b81258a9
commit 1475b83699
1 changed files with 11 additions and 7 deletions

View File

@ -41,8 +41,7 @@ namespace OSHttpServer
public int TimeoutFirstLine = 10000; // 10 seconds public int TimeoutFirstLine = 10000; // 10 seconds
public int TimeoutRequestReceived = 30000; // 30 seconds public int TimeoutRequestReceived = 30000; // 30 seconds
// The difference between this and request received is on POST more time is needed before we get the full request. public int TimeoutMaxIdle = 180000; // 3 minutes
public int TimeoutMaxIdle = 600000; // 10 minutes
public int m_TimeoutKeepAlive = 60000; public int m_TimeoutKeepAlive = 60000;
public int m_maxRequests = MAXREQUESTS; public int m_maxRequests = MAXREQUESTS;
@ -506,6 +505,7 @@ namespace OSHttpServer
if(!CanSend()) if(!CanSend())
return false; return false;
LastActivityTimeMS = ContextTimeoutManager.EnvironmentTickCount();
m_currentResponse?.SendNextAsync(bytesLimit); m_currentResponse?.SendNextAsync(bytesLimit);
return false; return false;
} }
@ -641,7 +641,10 @@ namespace OSHttpServer
if (offset + size > buffer.Length) if (offset + size > buffer.Length)
throw new ArgumentOutOfRangeException("offset", offset, "offset + size is beyond end of buffer."); throw new ArgumentOutOfRangeException("offset", offset, "offset + size is beyond end of buffer.");
LastActivityTimeMS = ContextTimeoutManager.EnvironmentTickCount();
bool ok = true; bool ok = true;
ContextTimeoutManager.ContextEnterActiveSend();
lock (sendLock) // can't have overlaps here lock (sendLock) // can't have overlaps here
{ {
try try
@ -652,12 +655,13 @@ namespace OSHttpServer
{ {
ok = false; ok = false;
} }
}
ContextTimeoutManager.ContextLeaveActiveSend();
if (!ok && m_stream != null) if (!ok && m_stream != null)
Disconnect(SocketError.NoRecovery); Disconnect(SocketError.NoRecovery);
return ok; return ok;
} }
}
public async Task<bool> SendAsync(byte[] buffer, int offset, int size) public async Task<bool> SendAsync(byte[] buffer, int offset, int size)
{ {