From dac6c5325c26ea2d772f721ae324d0052d056e63 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:58:25 +0000 Subject: Utilisateur : Fcolin Date : 3/02/06 Heure : 14:57 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 32) --- CSharp/Ivy/IvyPPC/IvyClient.cs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'CSharp') diff --git a/CSharp/Ivy/IvyPPC/IvyClient.cs b/CSharp/Ivy/IvyPPC/IvyClient.cs index a9d1cb8..2823b83 100644 --- a/CSharp/Ivy/IvyPPC/IvyClient.cs +++ b/CSharp/Ivy/IvyPPC/IvyClient.cs @@ -64,9 +64,7 @@ namespace IvyBus { get { - //IPHostEntry hostInfo = Dns.GetHostByAddress(((IPEndPoint)socket.RemoteEndPoint).Address); - IPHostEntry hostInfo = Dns.GetHostEntry(((IPEndPoint)socket.RemoteEndPoint).Address); - return hostInfo.HostName; + return remoteHost; } } @@ -74,7 +72,7 @@ namespace IvyBus { get { - return ((IPEndPoint)socket.RemoteEndPoint).Port; + return remotePort; } } @@ -90,6 +88,9 @@ namespace IvyBus private bool doping = false; private const int PINGTIMEOUT = 5000; private volatile Thread pingerThread; + + private int remotePort; + private string remoteHost; // protected variables internal String appName; @@ -102,6 +103,11 @@ namespace IvyBus appPort = 0; this.bus = bus; this.socket = socket; + + IPHostEntry hostInfo = Dns.GetHostEntry(((IPEndPoint)socket.RemoteEndPoint).Address); + remoteHost = hostInfo.HostName; + remotePort = ((IPEndPoint)socket.RemoteEndPoint).Port; + #if (!PocketPC ) doping = Properties.Settings.Default.IvyPing; #endif @@ -246,10 +252,11 @@ namespace IvyBus // Tell Thread to stop. if ( stream != null ) stream.Close(); - if (Thread.CurrentThread != clientThread && clientThread != null) + if (Thread.CurrentThread != clientThread && (clientThread != null) ) { // Wait for Thread to end. - clientThread.Join(); + bool term = clientThread.Join(10000); + if (!term && (clientThread != null) ) clientThread.Abort(); } clientThread = null; @@ -337,16 +344,16 @@ namespace IvyBus break; } } - if ( stream != null ) - { - stream.Close(); - stream = null; - } traceDebug("normally Disconnected from " + appName); traceDebug("Thread stopped"); // invokes the Disconnected applicationListeners bus.FireClientDisconnected(this); // first, I'm not a first class IvyClient any more + if (stream != null) + { + stream.Close(); + stream = null; + } bus.removeClient(this); } @@ -452,7 +459,7 @@ namespace IvyBus * an assymetric processing should be written */ if (bus.ReadyMessage != null) - sendMsg(bus.ReadyMessage); + sendMsg(bus.ReadyMessage); } override internal void TokenStartRegexp(ushort id, string arg) { -- cgit v1.1