From 99607f0dde8ce8a8dea58601d92d142a81cecec4 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 10:03:52 +0000 Subject: Utilisateur : Fcolin Date : 10/04/06 Heure : 18:45 Archivé dans $/CSharp/Ivy/Ivy Commentaire: optimisation diverse suite a passage de Code Analysis (vss 24) --- CSharp/Ivy/IvyPPC/IvyWatcher.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/CSharp/Ivy/IvyPPC/IvyWatcher.cs b/CSharp/Ivy/IvyPPC/IvyWatcher.cs index b164260..0c56d07 100644 --- a/CSharp/Ivy/IvyPPC/IvyWatcher.cs +++ b/CSharp/Ivy/IvyPPC/IvyWatcher.cs @@ -28,7 +28,6 @@ namespace IvyBus internal class IvyWatcher { private Ivy bus; /* master bus controler */ - private String domainaddr; private int port; private volatile Thread listenThread; private IPAddress group; @@ -45,7 +44,6 @@ namespace IvyBus internal IvyWatcher(Ivy bus, String domainaddr, int port) { this.bus = bus; - this.domainaddr = domainaddr; this.port = port; listenThread = new Thread(new ThreadStart(this.Run)); listenThread.Name = "Ivy UDP Listener Thread"; @@ -91,12 +89,12 @@ namespace IvyBus while (running) { ushort version; - ushort port; + ushort appPort; string appId; string appName; IPEndPoint remoteEP; - stream.receiveMsg(out remoteEP, out version, out port, out appId, out appName); + 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); @@ -111,22 +109,22 @@ namespace IvyBus // filtrage des self Broadcast if (appId == bus.AppId) continue; - if ((port == bus.applicationPort) && (remotehost.Equals(bus.applicationHost))) + if ((appPort == bus.applicationPort) && (remotehost.Equals(bus.applicationHost))) continue; - traceDebug("BUSWATCHER reponse au Broadcast de " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port + " port " + port + + traceDebug("BUSWATCHER reponse au Broadcast de " + Dns.GetHostEntry(remotehost).HostName + ":" + remoteEP.Port + " port " + appPort + " version " + version + " id " + appId + " name " + appName); try { Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - IPEndPoint hostEndPoint = new IPEndPoint(remoteEP.Address, port); + IPEndPoint hostEndPoint = new IPEndPoint(remoteEP.Address, appPort); socket.Connect(hostEndPoint); bus.addClient(socket, appName); } catch (Exception e) { - traceDebug("can't connect to " + remotehost + " port " + port + " \n" + e.Message); + traceDebug("can't connect to " + remotehost + " port " + appPort + " \n" + e.Message); } } // while -- cgit v1.1