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

Commit 823e8b2

Browse files
committed
fix retry
1 parent 75db454 commit 823e8b2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Titanium.Web.Proxy/Network/RetryPolicy.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ internal async Task<RetryResult> ExecuteAsync(Func<TcpServerConnection, Task<boo
3232
Exception exception = null;
3333

3434
var attempts = retries;
35-
while (attempts >= 0)
35+
36+
while (true)
3637
{
37-
3838
try
3939
{
4040
//setup connection
@@ -49,15 +49,17 @@ internal async Task<RetryResult> ExecuteAsync(Func<TcpServerConnection, Task<boo
4949
exception = ex;
5050
}
5151

52-
if(exception == null
52+
attempts--;
53+
54+
if (attempts < 0
55+
|| exception == null
5356
|| !(exception is T))
5457
{
5558
break;
5659
}
5760

5861
exception = null;
59-
await disposeConnection();
60-
attempts--;
62+
await disposeConnection();
6163
}
6264

6365
return new RetryResult(currentConnection, exception, @continue);

0 commit comments

Comments
 (0)