summaryrefslogtreecommitdiff
path: root/Ivy/IvyClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ivy/IvyClient.cs')
-rw-r--r--Ivy/IvyClient.cs20
1 files changed, 14 insertions, 6 deletions
diff --git a/Ivy/IvyClient.cs b/Ivy/IvyClient.cs
index 93f62ca..98d7901 100644
--- a/Ivy/IvyClient.cs
+++ b/Ivy/IvyClient.cs
@@ -291,6 +291,10 @@ namespace IvyBus
{
stream.Close(); // should stop the Reading Client Thread
}
+ catch (EndOfStreamException ioe)
+ {
+ throw new IvyException(ioe.Message);
+ }
catch (IOException ioe)
{
throw new IvyException(ioe.Message);
@@ -325,8 +329,11 @@ namespace IvyBus
try
{
- stream.TokenMsg(id, args);
- count++;
+ if (stream != null)
+ {
+ stream.TokenMsg(id, args);
+ count++;
+ }
}
catch (ObjectDisposedException ex)
{
@@ -581,13 +588,13 @@ namespace IvyBus
{
bus.OnDirectMessage(new IvyEventArgs(this,id,arg));
}
- void IvyProtocol.TokenPing(string arg)
+ void IvyProtocol.TokenPing(int id, string arg)
{
// I receive a ping. I can answer a pong.
Ivy.traceProtocol(Resources.IvyClient, Resources.PingReceive + appName + " : " + arg );
- stream.TokenPong(arg);
+ stream.TokenPong(id,arg);
}
- void IvyProtocol.TokenPong(string arg)
+ void IvyProtocol.TokenPong(int id, string arg)
{
Ivy.traceProtocol(Resources.IvyClient, Resources.PingReceive + appName + " : " + arg);
}
@@ -614,7 +621,8 @@ namespace IvyBus
try
{
Thread.Sleep(PINGTIMEOUT);
- stream.TokenPing(Resources.PingerThreadMessage);
+ int id = (int)DateTime.Now.Ticks;
+ stream.TokenPing( id, Resources.PingerThreadMessage);
}
catch (ThreadAbortException ie)
{