summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC/IvyWatcher.cs
diff options
context:
space:
mode:
Diffstat (limited to 'CSharp/Ivy/IvyPPC/IvyWatcher.cs')
-rw-r--r--CSharp/Ivy/IvyPPC/IvyWatcher.cs28
1 files changed, 11 insertions, 17 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyWatcher.cs b/CSharp/Ivy/IvyPPC/IvyWatcher.cs
index 9a0fc5b..092de81 100644
--- a/CSharp/Ivy/IvyPPC/IvyWatcher.cs
+++ b/CSharp/Ivy/IvyPPC/IvyWatcher.cs
@@ -81,7 +81,7 @@ namespace IvyBus
/// </summary>
public void Run()
{
- traceDebug("beginning of a watcher Thread");
+ Ivy.traceProtocol("IvyWatcher", "beginning of a watcher Thread");
try
{
@@ -97,13 +97,13 @@ namespace IvyBus
stream.receiveMsg(out remoteEP, out version, out appPort, out appId, out appName);
IPAddress remotehost = remoteEP.Address;
- traceDebug("BUSWATCHER Receive Broadcast from " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port);
+ Ivy.traceProtocol("IvyWatcher", "Receive Broadcast from " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port);
//TODO if ( !isInDomain( remotehost ) ) continue;
if (version != stream.ProtocolVersion)
{
- traceDebug("Ignoring bad protocol version " + version + " expected " + stream.ProtocolVersion);
+ Ivy.traceError("IvyWatcher","Ignoring bad protocol version " + version + " expected " + stream.ProtocolVersion);
continue;
}
@@ -113,7 +113,7 @@ namespace IvyBus
if ((appPort == bus.applicationPort) && (remotehost.Equals(bus.applicationHost)))
continue;
- traceDebug("BUSWATCHER reponse au Broadcast de " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port + " port " + appPort +
+ Ivy.traceProtocol("IvyWatcher", "reponse au Broadcast de " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port + " port " + appPort +
" version " + version +
" id " + appId +
" name " + appName);
@@ -122,25 +122,26 @@ namespace IvyBus
{
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint hostEndPoint = new IPEndPoint(remoteEP.Address, appPort);
+ socket.Blocking = true;
socket.Connect(hostEndPoint);
bus.addClient(socket, appName);
}
catch (Exception e)
{
- traceDebug("can't connect to " + remotehost + " port " + appPort + " \n" + e.Message);
+ Ivy.traceError("IvyWatcher","can't connect to " + remotehost + " port " + appPort + " \n" + e.Message);
}
} // while
}
catch (SocketException se)
{
- traceDebug("watcher socket closed: " + se.Message);
+ Ivy.traceError("IvyWatcher","watcher socket closed: " + se.Message);
}
catch (IOException ioe)
{
- traceDebug("watcher thread ended: " + ioe.Message);
+ Ivy.traceError("IvyWatcher","watcher thread ended: " + ioe.Message);
}
- traceDebug("end of a watcher thread");
+ Ivy.traceProtocol("IvyWatcher", "end of a watcher thread");
}
/// <summary> stops the thread waiting on the broadcast socket
@@ -149,7 +150,7 @@ namespace IvyBus
{
lock (stream)
{
- traceDebug("begining stopping an IvyWatcher");
+ Ivy.traceProtocol("IvyWatcher", "begining stopping an IvyWatcher");
stream.Close();
if (listenThread != null)
{
@@ -159,7 +160,7 @@ namespace IvyBus
listenThread = null;
}
// it might not even have been created
- traceDebug("ending stopping an IvyWatcher");
+ Ivy.traceProtocol("IvyWatcher", "ending stopping an IvyWatcher");
}
}
@@ -173,13 +174,6 @@ namespace IvyBus
}
}
- [Conditional("DEBUG")]
- private static void traceDebug(string s)
- {
- Trace.Assert(!Ivy.VerboseDebug, "-->ivywatcher<-- " + s);
- }
}
- // class IvyWatcher
- /* EOF */
} \ No newline at end of file