You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/12/17 05:47:03 UTC

svn commit: r604771 - /mina/trunk/core/src/main/java/org/apache/mina/filter/codec/CumulativeProtocolDecoder.java

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
+ * {@link #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 
+ * {@link TransportMetadata}.
+ * 
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @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