From 1475b836993316fcb7aa4f162dd5f4fb1db6cfe1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 21 Apr 2020 15:46:41 +0100 Subject: [PATCH] risk reduncing iddle timeout again, because it is needed on current framework --- .../OSHttpServer/HttpClientContext.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs index 4e0bee5933..c03650a64f 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpClientContext.cs @@ -41,8 +41,7 @@ namespace OSHttpServer public int TimeoutFirstLine = 10000; // 10 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 = 600000; // 10 minutes + public int TimeoutMaxIdle = 180000; // 3 minutes public int m_TimeoutKeepAlive = 60000; public int m_maxRequests = MAXREQUESTS; @@ -505,7 +504,8 @@ namespace OSHttpServer if(!CanSend()) return false; - + + LastActivityTimeMS = ContextTimeoutManager.EnvironmentTickCount(); m_currentResponse?.SendNextAsync(bytesLimit); return false; } @@ -641,7 +641,10 @@ namespace OSHttpServer if (offset + size > buffer.Length) throw new ArgumentOutOfRangeException("offset", offset, "offset + size is beyond end of buffer."); + LastActivityTimeMS = ContextTimeoutManager.EnvironmentTickCount(); + bool ok = true; + ContextTimeoutManager.ContextEnterActiveSend(); lock (sendLock) // can't have overlaps here { try @@ -652,11 +655,12 @@ namespace OSHttpServer { ok = false; } - - if (!ok && m_stream != null) - Disconnect(SocketError.NoRecovery); - return ok; } + + ContextTimeoutManager.ContextLeaveActiveSend(); + if (!ok && m_stream != null) + Disconnect(SocketError.NoRecovery); + return ok; } public async Task SendAsync(byte[] buffer, int offset, int size)