diff options
author | fcolin | 2007-02-01 09:46:59 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 09:46:59 +0000 |
commit | b2ff818e6dec86c3538eacb3f820c5f71465be16 (patch) | |
tree | 08a68323bc854a07938a74584c6771d649ccb342 | |
parent | ec4384a6d8baa1d79bad9fc9622e84716dd444a9 (diff) | |
download | ivy-csharp-b2ff818e6dec86c3538eacb3f820c5f71465be16.zip ivy-csharp-b2ff818e6dec86c3538eacb3f820c5f71465be16.tar.gz ivy-csharp-b2ff818e6dec86c3538eacb3f820c5f71465be16.tar.bz2 ivy-csharp-b2ff818e6dec86c3538eacb3f820c5f71465be16.tar.xz |
Utilisateur : Fcolin Date : 3/02/06 Heure : 14:57 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 32)
-rw-r--r-- | CSharp/Ivy/Ivy/IvyClient.cs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/CSharp/Ivy/Ivy/IvyClient.cs b/CSharp/Ivy/Ivy/IvyClient.cs index a9d1cb8..2823b83 100644 --- a/CSharp/Ivy/Ivy/IvyClient.cs +++ b/CSharp/Ivy/Ivy/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)
{
|