Commit 1c73d08d authored by justcoding121's avatar justcoding121

wrap cleanup task with try finally

parent aa2e3340
...@@ -423,6 +423,8 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -423,6 +423,8 @@ namespace Titanium.Web.Proxy.Network.Tcp
private async Task clearOutdatedConnections() private async Task clearOutdatedConnections()
{ {
while (runCleanUpTask) while (runCleanUpTask)
{
try
{ {
foreach (var item in cache) foreach (var item in cache)
{ {
...@@ -469,10 +471,14 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -469,10 +471,14 @@ namespace Titanium.Web.Proxy.Network.Tcp
connection?.Dispose(); connection?.Dispose();
} }
} }
}
finally
{
//cleanup every 3 seconds by default //cleanup every 3 seconds by default
await Task.Delay(1000 * 3); await Task.Delay(1000 * 3);
} }
}
} }
/// <summary> /// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment