summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC
diff options
context:
space:
mode:
Diffstat (limited to 'CSharp/Ivy/IvyPPC')
-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)
{