Skip to content

Commit

Permalink
Handle shifupool timeout errors. Catch errors coming from connection …
Browse files Browse the repository at this point in the history
…providers
  • Loading branch information
De-Crypted committed Apr 20, 2022
1 parent dad1540 commit 3bd202f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Managers/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ public Task StartAsync(CancellationToken cancellationToken)
SafeConsole.WriteLine(ConsoleColor.DarkGray, "{0:T}: Connecting to {1}", DateTime.Now, _url);
CurrentProvider = GetConnectionProvider(_url);
await CurrentProvider.RunAsync(_url);
try {
await CurrentProvider.RunAsync(_url);
} catch (Exception ex) {
SafeConsole.WriteLine(ConsoleColor.DarkRed, ex.ToString());
}
SafeConsole.WriteLine(ConsoleColor.DarkGray, "{0:T}: Disconnected from {1}", DateTime.Now, _url);
}
Expand Down
2 changes: 1 addition & 1 deletion Managers/StatusManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static void DoPeriodicReport()
public static void PrintHelp()
{
var helpMsg = @"|---------------------------------------|
| Available hotkeys |
| Hotkeys |
|---------------------------------------|
| H Print this help |
| P Pause mining |
Expand Down
6 changes: 6 additions & 0 deletions TcpClient/AsyncTcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ public async Task RunAsync()
Message?.Invoke(this, new AsyncTcpEventArgs("Connection reset remotely", ex));
readLength = -2;
}
catch (IOException ex) when ((ex.InnerException as SocketException)?.ErrorCode == (int)SocketError.TimedOut)
{
Message?.Invoke(this, new AsyncTcpEventArgs("Connection timed out", ex));
readLength = -1;
}
if (readLength <= 0)
{
if (readLength == 0)
Expand Down

0 comments on commit 3bd202f

Please sign in to comment.