diff options
-rw-r--r-- | CSharp/Ivy/Ivy/IvyClient.cs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/CSharp/Ivy/Ivy/IvyClient.cs b/CSharp/Ivy/Ivy/IvyClient.cs index fe70620..9b3c2f6 100644 --- a/CSharp/Ivy/Ivy/IvyClient.cs +++ b/CSharp/Ivy/Ivy/IvyClient.cs @@ -15,6 +15,7 @@ namespace IvyBus using System.Net;
using System.Net.Sockets;
using System.Configuration;
+ using System.Diagnostics;
/// <summary> A Class for the the peers on the bus.
/// </summary>
@@ -310,20 +311,19 @@ namespace IvyBus }
catch ( ObjectDisposedException e )
{
- traceDebug( "ivyclient socket closed "+e.Message );
+ traceDebug( "socket closed "+e.Message );
running = false;
break;
}
catch (IvyException ie)
{
- Console.Error.WriteLine(ie.Message);
- Console.Error.WriteLine(ie.StackTrace);
- running = false;
+ traceDebug("socket closed IvyException" + ie.Message);
+ running = false;
break;
}
catch (SocketException se)
{
- traceDebug( "ivyclient socket closed "+se.Message );
+ traceDebug( "socket closed "+se.Message );
running = false;
break;
}
@@ -331,14 +331,12 @@ namespace IvyBus {
if ( e.InnerException is SocketException )
{
- traceDebug( "ivyclient socket closed" );
+ traceDebug( "socket closed" );
}
else
{
traceDebug("abnormally Disconnected from " + RemoteAddress + ":" + RemotePort);
- Console.Error.WriteLine(e.Message);
- Console.Error.WriteLine(e.StackTrace);
}
running = false;
break;
@@ -430,7 +428,7 @@ namespace IvyBus }
catch (KeyNotFoundException ex)
{
- Console.Error.WriteLine("DelBinding " + ex.Message);
+ traceDebug("DelBinding " + ex.Message);
}
}
}
@@ -501,11 +499,11 @@ namespace IvyBus {
return "IvyClient " + bus.appName + ":" + appName;
}
-
+
+ [Conditional("DEBUG")]
private void traceDebug(String s)
{
- if (bus.VerboseDebug)
- Console.Error.WriteLine("-->IvyClient " + bus.appName + ":" + appName + "<-- " + s);
+ Trace.WriteLineIf(Ivy.VerboseDebug, "-->IvyClient " + bus.appName + ":" + appName + "<-- " + s);
}
internal bool isPinging = false;
|