summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC
diff options
context:
space:
mode:
Diffstat (limited to 'CSharp/Ivy/IvyPPC')
-rw-r--r--CSharp/Ivy/IvyPPC/IvyClient.cs51
1 files changed, 23 insertions, 28 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyClient.cs b/CSharp/Ivy/IvyPPC/IvyClient.cs
index 4960307..3db9f0f 100644
--- a/CSharp/Ivy/IvyPPC/IvyClient.cs
+++ b/CSharp/Ivy/IvyPPC/IvyClient.cs
@@ -162,7 +162,7 @@ namespace IvyBus
}
catch (IOException ex)
{ // the client nous a coupé l'herbe sous le pied
- traceDebug("I can't send my message to this client. He probably left " + ex.Message);
+ Ivy.traceError("IvyClient","I can't send my message to this client. He probably left " + ex.Message);
// invokes the Disconnected applicationListeners
//bus.OnClientDisconnected(new IvyEventArgs(this,id, message ));
// called by the receiver Thread
@@ -192,7 +192,7 @@ namespace IvyBus
}
catch (IOException ex)
{
- traceDebug("I can't send my message to this client. He probably left "+ex.Message);
+ Ivy.traceError("IvyClient","I can't send my message to this client. He probably left "+ex.Message);
// first, I'm not a first class IvyClient any more
bus.removeClient(this);
// invokes the Disconnected applicationListeners
@@ -210,7 +210,7 @@ namespace IvyBus
/// </param>
internal void close(bool notify)
{
- traceDebug("closing connexion to " + appName);
+ Ivy.traceProtocol("IvyClient","closing connexion to " + appName);
if (doping )
{
StopPinging();
@@ -281,7 +281,7 @@ namespace IvyBus
}
catch (IOException ex)
{
- traceDebug("I can't send my message to this client. He probably left " + ex.Message);
+ Ivy.traceError("IvyClient","I can't send my message to this client. He probably left " + ex.Message);
// first, I'm not a first class IvyClient any more
bus.removeClient(this);
// invokes the Disconnected applicationListeners
@@ -311,9 +311,9 @@ namespace IvyBus
/// </summary>
private void Run()
{
- traceDebug("Connected from " + RemoteAddress + ":" + RemotePort);
+ Ivy.traceProtocol("IvyClient","Connected from " + RemoteAddress + ":" + RemotePort);
- traceDebug("Thread started");
+ Ivy.traceProtocol("IvyClient","Thread started");
bool running = true;
while ( running && (stream != null) )
@@ -328,26 +328,26 @@ namespace IvyBus
}
else
{
- traceDebug("receiveMsg false ! leaving the thread");
+ Ivy.traceProtocol("IvyClient","receiveMsg false ! leaving the thread");
running = false;
break;
}
}
catch ( ObjectDisposedException ex )
{
- traceDebug( "socket closed "+ex.Message );
+ Ivy.traceError("IvyClient", "socket closed "+ex.Message );
running = false;
break;
}
catch (IvyException ie)
{
- traceDebug("socket closed IvyException" + ie.Message);
+ Ivy.traceError("IvyClient","socket closed IvyException" + ie.Message);
running = false;
break;
}
catch (SocketException se)
{
- traceDebug( "socket closed "+se.Message );
+ Ivy.traceError("IvyClient", "socket closed "+se.Message );
running = false;
break;
}
@@ -355,19 +355,19 @@ namespace IvyBus
{
if ( ex.InnerException is SocketException )
{
- traceDebug( "socket closed" );
+ Ivy.traceProtocol("IvyClient", "socket closed" );
}
else
{
- traceDebug("abnormally Disconnected from " + RemoteAddress + ":" + RemotePort);
+ Ivy.traceError("IvyClient","abnormally Disconnected from " + RemoteAddress + ":" + RemotePort);
}
running = false;
break;
}
}
- traceDebug("normally Disconnected from " + appName);
- traceDebug("Thread stopped");
+ Ivy.traceProtocol("IvyClient","normally Disconnected from " + appName);
+ Ivy.traceProtocol("IvyClient","Thread stopped");
// invokes the Disconnected applicationListeners
bus.OnClientDisconnected(new IvyEventArgs(this,0, "" ));
// first, I'm not a first class IvyClient any more
@@ -390,7 +390,7 @@ namespace IvyBus
}
void IvyProtocol.TokenDie(ushort id, string arg)
{
- traceDebug("received die Message from " + appName + "Raison: "+ arg);
+ Ivy.traceProtocol("IvyClient","received die Message from " + appName + "Raison: "+ arg);
// invokes the die applicationListeners
IvyDieEventArgs ev = new IvyDieEventArgs(this, id, arg);
bus.OnDie(ev);
@@ -409,7 +409,7 @@ namespace IvyBus
void IvyProtocol.TokenBye(ushort err, string arg)
{
// the peer quits
- traceDebug("received bye Message from " + appName + "Raison: "+ arg);
+ Ivy.traceProtocol("IvyClient","received bye Message from " + appName + "Raison: "+ arg);
// first, I'm not a first class IvyClient any more
//bus.removeClient(this); // this is done in the receive thread terminaison!!
// invokes the disconnect applicationListeners
@@ -463,7 +463,7 @@ namespace IvyBus
}
catch (KeyNotFoundException ex)
{
- traceDebug("DelBinding " + ex.Message);
+ Ivy.traceError("IvyClient","DelBinding " + ex.Message);
}
}
}
@@ -474,7 +474,7 @@ namespace IvyBus
void IvyProtocol.TokenError(ushort id, string arg)
{
bus.OnError(new IvyEventArgs(this, id, arg));
- traceDebug("Error msg " + id + " " + arg);
+ Ivy.traceError("IvyClient","Error msg " + id + " " + arg);
}
void IvyProtocol.TokenApplicationId(ushort id, string arg)
{
@@ -513,12 +513,12 @@ namespace IvyBus
void IvyProtocol.TokenPing(string arg)
{
// I receive a ping. I can answer a pong.
- traceDebug("Ping msg from " + appName + " : " + arg );
+ Ivy.traceProtocol("IvyClient","Ping msg from " + appName + " : " + arg );
stream.TokenPong(arg);
}
void IvyProtocol.TokenPong(string arg)
{
- traceDebug("Ping msg from " + appName + " : " + arg);
+ Ivy.traceProtocol("IvyClient","Ping msg from " + appName + " : " + arg);
}
@@ -528,18 +528,13 @@ namespace IvyBus
return "IvyClient " + bus.appName + ":" + appName;
}
- [Conditional("DEBUG")]
- private void traceDebug(String s)
- {
- Trace.Assert(!Ivy.VerboseDebug, "-->IvyClient " + bus.appName + ":" + appName + "<-- " + s);
- }
/* is the Pinging Thread Runninng */
internal bool isPinging;
private void PingerRun()
{
isPinging = true;
- traceDebug("Pinger Thread started");
+ Ivy.traceProtocol("IvyClient","Pinger Thread started");
while (isPinging)
{
try
@@ -549,10 +544,10 @@ namespace IvyBus
}
catch (ThreadAbortException ie)
{
- traceDebug("Pinger Thread killed "+ie.Message);
+ Ivy.traceError("IvyClient","Pinger Thread killed "+ie.Message);
}
}
- traceDebug("Pinger Thread stopped");
+ Ivy.traceProtocol("IvyClient","Pinger Thread stopped");
}
public virtual void StopPinging()
{