From 05bd5a1f5f07901d1584a423a256684ad02e232d Mon Sep 17 00:00:00 2001 From: webwarrior Date: Mon, 9 Jan 2023 11:17:30 +0100 Subject: [PATCH] Utility: made Retry func take 1 type parameter Changed Retry function to take 1 type parameter instead of 2 as handling 2 types of exceptions is not needed anymore because SocketException is wrapped in NOnionException. --- NOnion/Services/TorServiceHost.fs | 2 +- NOnion/Utility/FSharpUtil.fs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NOnion/Services/TorServiceHost.fs b/NOnion/Services/TorServiceHost.fs index a0b97d88..5d31649e 100644 --- a/NOnion/Services/TorServiceHost.fs +++ b/NOnion/Services/TorServiceHost.fs @@ -246,7 +246,7 @@ type TorServiceHost introEncPubKey do! - FSharpUtil.Retry + FSharpUtil.Retry connectToRendezvousJob maxRendezvousConnectRetryCount diff --git a/NOnion/Utility/FSharpUtil.fs b/NOnion/Utility/FSharpUtil.fs index f3c42494..24aeb741 100644 --- a/NOnion/Utility/FSharpUtil.fs +++ b/NOnion/Utility/FSharpUtil.fs @@ -65,7 +65,7 @@ module FSharpUtil = return failwith "unreachable" } - let Retry<'E1, 'E2 when 'E1 :> Exception and 'E2 :> Exception> + let Retry<'TEx when 'TEx :> Exception> (jobToRetry: Async) (maxRetryCount: int) = @@ -74,8 +74,7 @@ module FSharpUtil = try do! jobToRetry with - | :? 'E1 - | :? 'E2 as ex -> + | :? 'TEx as ex -> if tryNumber < maxRetryCount then return! retryLoop(tryNumber + 1) else