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/IvyTCPStreamV3.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'Ivy/IvyTCPStreamV3.cs') diff --git a/Ivy/IvyTCPStreamV3.cs b/Ivy/IvyTCPStreamV3.cs index e261f5e..6c23726 100644 --- a/Ivy/IvyTCPStreamV3.cs +++ b/Ivy/IvyTCPStreamV3.cs @@ -31,10 +31,11 @@ namespace IvyBus this.input = new StreamReader(this, Ivy.ivyEncoding); this.receiver = receiver; } - internal void Close() + void IvyProtocol.Close() { - this.input.Close(); this.output.Close(); + this.input.Close(); + this.Socket.Shutdown(SocketShutdown.Both); base.Close(); } @@ -110,14 +111,14 @@ namespace IvyBus this.SendMsg(MessageType.DirectMsg, id, message); } - void IvyProtocol.TokenPong(string s) + void IvyProtocol.TokenPong(int id, string s) { - this.SendMsg(MessageType.Pong, 0, s); + this.SendMsg(MessageType.Pong, id, s); } - void IvyProtocol.TokenPing(string s) + void IvyProtocol.TokenPing(int id, string s) { - this.SendMsg(MessageType.Ping, 0, s); + this.SendMsg(MessageType.Ping, id, s); } void IvyProtocol.TokenBye(int id, string message) @@ -223,11 +224,11 @@ namespace IvyBus break; case MessageType.Pong: - this.receiver.TokenPong(msgData); + this.receiver.TokenPong(msgId,msgData); break; case MessageType.Ping: - this.receiver.TokenPing(msgData); + this.receiver.TokenPing(msgId,msgData); break; case MessageType.Error: @@ -249,6 +250,10 @@ namespace IvyBus } + catch (NullReferenceException) + { + return false; + } catch (EndOfStreamException) { return false; -- cgit v1.1