Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 75db454

Browse files
committed
fix object reference null error
1 parent 70635fd commit 75db454

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

Titanium.Web.Proxy/Network/RetryPolicy.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,19 @@ internal async Task<RetryResult> ExecuteAsync(Func<TcpServerConnection, Task<boo
4444
@continue = await action(currentConnection);
4545

4646
}
47-
catch (T ex)
48-
{
49-
await disposeConnection();
47+
catch (Exception ex)
48+
{
5049
exception = ex;
5150
}
52-
catch
53-
{
54-
await disposeConnection();
55-
throw;
56-
}
5751

58-
if(exception == null)
52+
if(exception == null
53+
|| !(exception is T))
5954
{
6055
break;
6156
}
6257

6358
exception = null;
59+
await disposeConnection();
6460
attempts--;
6561
}
6662

Titanium.Web.Proxy/RequestHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ await handleWebSocketUpgrade(httpCmd, args, request,
267267
//between sessions without using it.
268268
//Do not release authenticated connections for performance reasons.
269269
//Otherwise it will keep authenticating per session.
270-
if (EnableConnectionPool && !connection.IsWinAuthenticated)
270+
if (EnableConnectionPool && connection!=null
271+
&& !connection.IsWinAuthenticated)
271272
{
272273
await tcpConnectionFactory.Release(connection);
273274
connection = null;

0 commit comments

Comments
 (0)