Skip to content

Commit

Permalink
Improve logging for failed TCP connections due to hostname (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentDondain authored and spouliot committed Aug 14, 2019
1 parent 1c41c75 commit a2e1810
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions NUnitLite/TouchRunner/TouchRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,9 @@ static string SelectHostName (string[] names, int port)
result = name;
}
evt.Set ();
} catch (Exception) {
} catch (Exception e) {
lock (lock_obj) {
Console.WriteLine ("TCP connection failed when selecting 'hostname': {0} and 'port': {1}. {2}", name, port, e);
failures++;
if (failures == names.Length)
evt.Set ();
Expand Down Expand Up @@ -266,8 +267,10 @@ public bool OpenWriter (string message)
goto case "TCP";
case "TCP":
hostname = SelectHostName (options.HostName.Split (','), options.HostPort);
if (string.IsNullOrEmpty (hostname))
if (string.IsNullOrEmpty (hostname)) {
Console.WriteLine ("Couldn't establish a TCP connection with any of the hostnames: {0}", options.HostName);
break;
}
Console.WriteLine ("[{0}] Sending '{1}' results to {2}:{3}", now, message, hostname, options.HostPort);
defaultWriter = new TcpTextWriter (hostname, options.HostPort);
break;
Expand Down

0 comments on commit a2e1810

Please sign in to comment.