You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by js...@apache.org on 2006/03/09 23:57:15 UTC
svn commit: r384638 -
/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java
Author: jstrachan
Date: Thu Mar 9 14:57:13 2006
New Revision: 384638
URL: http://svn.apache.org/viewcvs?rev=384638&view=rev
Log:
fix bug in fragmentation
Modified:
incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java
Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java?rev=384638&r1=384637&r2=384638&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/CommandChannel.java Thu Mar 9 14:57:13 2006
@@ -179,7 +179,6 @@
public void write(Command command, SocketAddress address) throws IOException {
synchronized (writeLock) {
- header.incrementCounter();
ByteArrayOutputStream largeBuffer = new ByteArrayOutputStream(largeMessageBufferSize);
wireFormat.marshal(command, new DataOutputStream(largeBuffer));
@@ -187,6 +186,7 @@
int size = data.length;
if (size < datagramSize) {
+ header.incrementCounter();
header.setPartial(false);
header.setComplete(true);
header.setDataSize(size);
@@ -210,6 +210,10 @@
writeBuffer.rewind();
int chunkSize = writeBuffer.capacity() - headerMarshaller.getHeaderSize(header);
lastFragment = offset + chunkSize >= length;
+ if (lastFragment) {
+ chunkSize = length - offset;
+ }
+ header.incrementCounter();
header.setDataSize(chunkSize);
header.setComplete(lastFragment);
headerMarshaller.writeHeader(header, writeBuffer);