From 7a2293d7435cbe6fd8444849c997d3f4cb8c8db1 Mon Sep 17 00:00:00 2001 From: "Timothy A. Bish" Date: Tue, 23 Oct 2012 19:15:34 +0000 Subject: [PATCH] fix and test for: https://issues.apache.org/jira/browse/AMQ-4106 NIO based transports weren't updating the receive counter in the TcpTransport which can lead to the inactivity monitor mistakenly shutting down the connection. Forgot one. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1401397 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/transport/mqtt/MQTTNIOTransport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/mqtt/MQTTNIOTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/mqtt/MQTTNIOTransport.java index a85f5467d5..8b8a6c99a0 100644 --- a/activemq-core/src/main/java/org/apache/activemq/transport/mqtt/MQTTNIOTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/mqtt/MQTTNIOTransport.java @@ -27,6 +27,7 @@ import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; import javax.net.SocketFactory; + import org.apache.activemq.transport.nio.NIOOutputStream; import org.apache.activemq.transport.nio.SelectorManager; import org.apache.activemq.transport.nio.SelectorSelection; @@ -103,9 +104,10 @@ public class MQTTNIOTransport extends TcpTransport { DataByteArrayInputStream dis = new DataByteArrayInputStream(inputBuffer.array()); codec.parse(dis, readSize); + receiveCounter += readSize; + // clear the buffer inputBuffer.clear(); - } } catch (IOException e) { onException(e);