activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1206935 - in /activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp: StompCodec.scala StompProtocolHandler.scala
Date Mon, 28 Nov 2011 00:13:30 GMT
Author: chirino
Date: Mon Nov 28 00:13:20 2011
New Revision: 1206935

URL: http://svn.apache.org/viewvc?rev=1206935&view=rev
Log:
Optimize header decoding a bit and log connection errors at info level.

Modified:
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompCodec.scala
    activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompCodec.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompCodec.scala?rev=1206935&r1=1206934&r2=1206935&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompCodec.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompCodec.scala
Mon Nov 28 00:13:20 2011
@@ -433,9 +433,8 @@ class StompCodec extends ProtocolCodec {
   }
 
   def read_headers(action:AsciiBuffer, headers:HeaderMapBuffer=new HeaderMapBuffer()):FrameReader
= (buffer)=> {
-    var rc:StompFrame = null
-    val line = read_line(buffer, max_header_length, "The maximum header length was exceeded")
-    if( line !=null ) {
+    var line = read_line(buffer, max_header_length, "The maximum header length was exceeded")
+    while( line !=null ) {
       if( line.trim().length > 0 ) {
 
         if (max_headers != -1 && headers.size > max_headers) {
@@ -445,6 +444,9 @@ class StompCodec extends ProtocolCodec {
         try {
             val seperatorIndex = line.indexOf(COLON)
             if( seperatorIndex<0 ) {
+                println("===")
+                println(new AsciiBuffer(buffer.array(), 0, read_buffer_size))
+                println("===")
                 throw new IOException("Header line missing seperator [" + ascii(line) + "]")
             }
             var name = line.slice(0, seperatorIndex)
@@ -461,6 +463,7 @@ class StompCodec extends ProtocolCodec {
               throw new IOException("Unable to parser header line [" + line + "]")
         }
 
+        line = read_line(buffer, max_header_length, "The maximum header length was exceeded")
       } else {
         val contentLength = get(headers, CONTENT_LENGTH)
         if (contentLength.isDefined) {
@@ -504,9 +507,10 @@ class StompCodec extends ProtocolCodec {
         } else {
           next_action = read_text_body(action, headers)
         }
+        line = null
       }
     }
-    rc
+    null
   }
 
   def get(headers:HeaderMapBuffer, name:AsciiBuffer):Option[AsciiBuffer] = {

Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala?rev=1206935&r1=1206934&r2=1206935&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocolHandler.scala
Mon Nov 28 00:13:20 2011
@@ -1220,7 +1220,7 @@ class StompProtocolHandler extends Proto
   override def on_transport_failure(error: IOException) = {
     if( !connection.stopped ) {
       suspendRead("shutdown")
-      connection_log.debug(error, "Shutting connection '%s'  down due to: %s", security_context.remote_address,
error)
+      connection_log.info(error, "Shutting connection '%s'  down due to: %s", security_context.remote_address,
error)
       super.on_transport_failure(error);
     }
   }



Mime
View raw message