qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r1611456 - in /qpid/proton/trunk/proton-j/src: main/java/org/apache/qpid/proton/engine/impl/ test/java/org/apache/qpid/proton/engine/impl/
Date Thu, 17 Jul 2014 19:52:27 GMT
Author: rhs
Date: Thu Jul 17 19:52:26 2014
New Revision: 1611456

URL: http://svn.apache.org/r1611456
Log:
fixed error/end of stream handling

Modified:
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameHandler.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameParser.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SaslImpl.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptor.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputWriter.java
    qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptorTest.java

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameHandler.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameHandler.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameHandler.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameHandler.java
Thu Jul 17 19:52:26 2014
@@ -20,6 +20,7 @@
  */
 package org.apache.qpid.proton.engine.impl;
 
+import org.apache.qpid.proton.engine.TransportException;
 import org.apache.qpid.proton.framing.TransportFrame;
 
 public interface FrameHandler
@@ -31,7 +32,7 @@ public interface FrameHandler
      */
     boolean handleFrame(TransportFrame frame);
 
-    void closed();
+    void closed(TransportException error);
 
     /**
      * Returns whether I am currently able to handle frames.

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameParser.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameParser.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameParser.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/FrameParser.java
Thu Jul 17 19:52:26 2014
@@ -447,7 +447,7 @@ class FrameParser implements TransportIn
                 state = State.ERROR;
                 frameParsingError = new TransportException("connection aborted");
             } else {
-                _frameHandler.closed();
+                _frameHandler.closed(null);
             }
         }
 
@@ -460,7 +460,7 @@ class FrameParser implements TransportIn
             if(frameParsingError != null)
             {
                 _parsingError = frameParsingError;
-                throw frameParsingError;
+                _frameHandler.closed(frameParsingError);
             }
             else
             {

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SaslImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SaslImpl.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SaslImpl.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/SaslImpl.java
Thu Jul 17 19:52:26 2014
@@ -565,6 +565,9 @@ public class SaslImpl implements Sasl, S
             _tail_closed = true;
             if (isInputInSaslMode()) {
                 _head_closed = true;
+                _underlyingInput.close_tail();
+            } else {
+                _underlyingInput.close_tail();
             }
         }
 

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
Thu Jul 17 19:52:26 2014
@@ -22,7 +22,9 @@ import static org.apache.qpid.proton.eng
 
 import java.nio.ByteBuffer;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.qpid.proton.amqp.Binary;
 import org.apache.qpid.proton.amqp.UnsignedInteger;
@@ -30,6 +32,7 @@ import org.apache.qpid.proton.amqp.Unsig
 import org.apache.qpid.proton.amqp.transport.Attach;
 import org.apache.qpid.proton.amqp.transport.Begin;
 import org.apache.qpid.proton.amqp.transport.Close;
+import org.apache.qpid.proton.amqp.transport.ConnectionError;
 import org.apache.qpid.proton.amqp.transport.Detach;
 import org.apache.qpid.proton.amqp.transport.Disposition;
 import org.apache.qpid.proton.amqp.transport.End;
@@ -1189,10 +1192,15 @@ public class TransportImpl extends Endpo
     }
 
     @Override
-    public void closed()
+    public void closed(TransportException error)
     {
-        if (!_closeReceived) {
-            throw new TransportException("connection aborted");
+        if (!_closeReceived || error != null) {
+            Close close = new Close();
+            String msg = error == null ? "connection aborted" : error.toString();
+            close.setError(new ErrorCondition(ConnectionError.FRAMING_ERROR, msg));
+            _isCloseSent = true;
+            writeFrame(0, close, null, null);
+            _head_closed = true;
         }
     }
 

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptor.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptor.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptor.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptor.java
Thu Jul 17 19:52:26 2014
@@ -98,7 +98,7 @@ class TransportOutputAdaptor implements 
     public void close_head()
     {
         _head_closed = true;
-        _transportOutputWriter.closed();
+        _transportOutputWriter.closed(null);
         release_buffers();
     }
 

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputWriter.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputWriter.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputWriter.java
(original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportOutputWriter.java
Thu Jul 17 19:52:26 2014
@@ -20,6 +20,8 @@ package org.apache.qpid.proton.engine.im
 
 import java.nio.ByteBuffer;
 
+import org.apache.qpid.proton.engine.TransportException;
+
 interface TransportOutputWriter
 {
     /**
@@ -28,6 +30,6 @@ interface TransportOutputWriter
      */
     boolean writeInto(ByteBuffer outputBuffer);
 
-    void closed();
+    void closed(TransportException error);
 
 }

Modified: qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptorTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptorTest.java?rev=1611456&r1=1611455&r2=1611456&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptorTest.java
(original)
+++ qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/engine/impl/TransportOutputAdaptorTest.java
Thu Jul 17 19:52:26 2014
@@ -25,6 +25,8 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.apache.qpid.proton.engine.TransportException;
+
 import java.nio.ByteBuffer;
 
 import org.junit.Test;
@@ -143,7 +145,7 @@ public class TransportOutputAdaptorTest
             _cannedOutput = cannedOutput;
         }
 
-        public void closed()
+        public void closed(TransportException error)
         {
             // do nothing
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message