summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 10:04:02 +0000
committerfcolin2007-02-01 10:04:02 +0000
commitaf0b070baaaf9433a842d45eddbc3f98bdd4bf99 (patch)
tree580aabd82c03b4666f164a8fda1d95247495acaf
parent88533ad731828bec0d87731e7e042fe80fb5bd71 (diff)
downloadivy-csharp-af0b070baaaf9433a842d45eddbc3f98bdd4bf99.zip
ivy-csharp-af0b070baaaf9433a842d45eddbc3f98bdd4bf99.tar.gz
ivy-csharp-af0b070baaaf9433a842d45eddbc3f98bdd4bf99.tar.bz2
ivy-csharp-af0b070baaaf9433a842d45eddbc3f98bdd4bf99.tar.xz
Utilisateur : Fcolin Date : 17/10/06 Heure : 18:36 Archivé dans $/CSharp/Ivy/Ivy Commentaire: modification debug et correction bug stream UDP pas reseté (vss 29)
-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