Author: trustin
Date: Sun Dec 16 20:47:03 2007
New Revision: 604771
URL: http://svn.apache.org/viewvc?rev=604771&view=rev
Log:
Improved CumulativeProtocolDecoder not to provide buffer cumulation if the
transport doesn't have fragmentation.
Modified:
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java
Modified:
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java
URL:
http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java?rev=604771&r1=604770&r2=604771&view=diff
==============================================================================
---
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java
(original)
+++
mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java
Sun Dec 16 20:47:03 2007
@@ -22,6 +22,7 @@
import org.apache.mina.common.AttributeKey;
import org.apache.mina.common.IoBuffer;
import org.apache.mina.common.IoSession;
+import org.apache.mina.common.TransportMetadata;
import org.apache.mina.common.UnderivableBuffer;
/**
@@ -91,7 +92,13 @@
* }
* }
* </pre>
- *
+ * <p>
+ * Please not that this decoder simply forward the call to
+ * [EMAIL PROTECTED] #doDecode(IoSession, IoBuffer, ProtocolDecoderOutput)} if
the
+ * underlying transport doesn't have a packet fragmentation. Whether the
+ * transport has fragmentation or not is determined by querying
+ * [EMAIL PROTECTED] TransportMetadata}.
+ *
* @author The Apache MINA Project ([EMAIL PROTECTED])
* @version $Rev$, $Date$
*/
@@ -116,6 +123,11 @@
*/
public void decode(IoSession session, IoBuffer in,
ProtocolDecoderOutput out) throws Exception {
+ if (!session.getTransportMetadata().hasFragmentation()) {
+ doDecode(session, in, out);
+ return;
+ }
+
boolean usingSessionBuffer = true;
IoBuffer buf = (IoBuffer) session.getAttribute(BUFFER);
// If we have a session buffer, append data to that; otherwise