Author: tabish Date: Mon Nov 8 20:52:02 2010 New Revision: 1032703 URL: http://svn.apache.org/viewvc?rev=1032703&view=rev Log: https://issues.apache.org/activemq/browse/AMQNET-284 Sets the Host field on the v1.1+ Connect Frame. Tweaks the Frame's keep alive send a bit more. Updates the Inactivity monitor to better log its state and to no send the keep alive through its own Oneway method which was causing it to miss every other KeepAliveInfo send. Also sets the Inactivity read check to use a generous window since Apollo seems to take twice as long as you ask it to send you a KeepAlive. Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompFrame.cs activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs?rev=1032703&r1=1032702&r2=1032703&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Connection.cs Mon Nov 8 20:52:02 2010 @@ -81,6 +81,7 @@ namespace Apache.NMS.Stomp this.info = new ConnectionInfo(); this.info.ConnectionId = id; + this.info.Host = brokerUri.Host; this.messageTransformation = new StompMessageTransformation(this); } Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompFrame.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompFrame.cs?rev=1032703&r1=1032702&r2=1032703&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompFrame.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Protocol/StompFrame.cs Mon Nov 8 20:52:02 2010 @@ -139,6 +139,7 @@ namespace Apache.NMS.Stomp.Protocol if(this.Command == KEEPALIVE) { dataOut.Write(NEWLINE); + dataOut.Flush(); return; } Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs?rev=1032703&r1=1032702&r2=1032703&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/InactivityMonitor.cs Mon Nov 8 20:52:02 2010 @@ -103,7 +103,7 @@ namespace Apache.NMS.Stomp.Transport public void CheckConnection(object state) { - Tracer.DebugFormat("Timer Elapsed at {0}", DateTime.Now.ToLocalTime()); + Tracer.DebugFormat("CheckConnection: Timer Elapsed at {0}", DateTime.Now.ToLocalTime()); // First see if we have written or can write. WriteCheck(); @@ -125,16 +125,16 @@ namespace Apache.NMS.Stomp.Transport return; } -// if(!commandSent.Value) -// { - Tracer.Debug("No Message sent since last write check. Sending a KeepAliveInfo"); + if(!commandSent.Value) + { + //Tracer.Debug("No Message sent since last write check. Sending a KeepAliveInfo"); this.asyncWriteTask.IsPending = true; this.asyncTasks.Wakeup(); -// } -// else -// { -// Tracer.Debug("Message sent since last write check. Resetting flag"); -// } + } + else + { + Tracer.Debug("Message sent since last write check. Resetting flag"); + } commandSent.Value = false; } @@ -180,7 +180,7 @@ namespace Apache.NMS.Stomp.Transport /// public bool AllowReadCheck(TimeSpan elapsed) { - return (elapsed.TotalMilliseconds > (readCheckTime + readCheckTime * 0.90) ); + return (elapsed.TotalMilliseconds > (readCheckTime * 2) ); } #endregion @@ -211,6 +211,16 @@ namespace Apache.NMS.Stomp.Transport } } } + else if(command.IsKeepAliveInfo) + { + if(Tracer.IsDebugEnabled) + { + Tracer.Debug("InactivityMonitor: New Keep Alive Received at -> " + + DateTime.Now.ToLongTimeString().TrimEnd(" APM".ToCharArray()) + + "." + DateTime.Now.Millisecond); + } + } + base.OnCommand(sender, command); } finally @@ -420,7 +430,7 @@ namespace Apache.NMS.Stomp.Transport try { KeepAliveInfo info = new KeepAliveInfo(); - this.parent.Oneway(info); + this.parent.next.Oneway(info); } catch(IOException e) {