From ebc2a8ef21bd90e753cf9b88ea186b0c87775de3 Mon Sep 17 00:00:00 2001 From: fcolin Date: Fri, 12 Mar 2010 16:40:27 +0000 Subject: mise en conformité des messages ping /pong start regexpid a 0 catch plantage NULL ref Correction pb a la fermeture d'ivy --- Ivy/IvyClient.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'Ivy/IvyClient.cs') 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) { -- cgit v1.1