From af0b070baaaf9433a842d45eddbc3f98bdd4bf99 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 10:04:02 +0000 Subject: 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) --- CSharp/Ivy/IvyPPC/IvyWatcher.cs | 28 +++++++++++----------------- 1 file 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 /// 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"); } /// 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 -- cgit v1.1