summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC/IvyClient.cs
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:58:25 +0000
committerfcolin2007-02-01 09:58:25 +0000
commitdac6c5325c26ea2d772f721ae324d0052d056e63 (patch)
treefe8c874a9ae026d6674c84e62a7c82b134663579 /CSharp/Ivy/IvyPPC/IvyClient.cs
parent4bda7fccaa81ed92957e5ed92a120feb4d19787e (diff)
downloadivy-csharp-dac6c5325c26ea2d772f721ae324d0052d056e63.zip
ivy-csharp-dac6c5325c26ea2d772f721ae324d0052d056e63.tar.gz
ivy-csharp-dac6c5325c26ea2d772f721ae324d0052d056e63.tar.bz2
ivy-csharp-dac6c5325c26ea2d772f721ae324d0052d056e63.tar.xz
Utilisateur : Fcolin Date : 3/02/06 Heure : 14:57 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 32)
Diffstat (limited to 'CSharp/Ivy/IvyPPC/IvyClient.cs')
-rw-r--r--CSharp/Ivy/IvyPPC/IvyClient.cs31
1 files changed, 19 insertions, 12 deletions
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)
{