qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [02/10] qpid-broker-j git commit: QPID-7531: [Java Broker, AMQP 1.0] Allow receiving of Transfers on semi-detached links but end the session if link is errored
Date Thu, 05 Oct 2017 19:20:04 GMT
QPID-7531: [Java Broker, AMQP 1.0] Allow receiving of Transfers on semi-detached links but
end the session if link is errored


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/6a7633d0
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/6a7633d0
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/6a7633d0

Branch: refs/heads/master
Commit: 6a7633d0ba1361a69f8249fffb72a23d8ceb7fc0
Parents: 634eb6a
Author: Lorenz Quack <lquack@apache.org>
Authored: Wed Oct 4 16:01:26 2017 +0100
Committer: Alex Rudyy <orudyy@apache.org>
Committed: Thu Oct 5 12:18:29 2017 +0100

----------------------------------------------------------------------
 .../qpid/server/protocol/v1_0/AbstractLinkEndpoint.java | 12 ++++++++++++
 .../protocol/v1_0/AbstractReceivingLinkEndpoint.java    | 11 ++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a7633d0/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractLinkEndpoint.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractLinkEndpoint.java
b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractLinkEndpoint.java
index 287979a..429bf94 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractLinkEndpoint.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractLinkEndpoint.java
@@ -73,6 +73,7 @@ public abstract class AbstractLinkEndpoint<S extends BaseSource, T extends
BaseT
     private volatile UnsignedInteger _localHandle;
     private volatile Map<Symbol, Object> _properties;
     private volatile State _state = State.ATTACH_RECVD;
+    private volatile boolean _errored = false;
 
     protected boolean _remoteIncompleteUnsettled;
     protected boolean _localIncompleteUnsettled;
@@ -105,6 +106,7 @@ public abstract class AbstractLinkEndpoint<S extends BaseSource, T
extends BaseT
     @Override
     public void receiveAttach(final Attach attach) throws AmqpErrorException
     {
+        _errored = false;
         boolean isAttachingLocalTerminusNull = (attach.getRole() == Role.SENDER ? attach.getTarget()
== null : attach.getSource() == null);
         boolean isLocalTerminusNull = (attach.getRole() == Role.SENDER ? getTarget() == null
: getSource() == null);
 
@@ -433,6 +435,11 @@ public abstract class AbstractLinkEndpoint<S extends BaseSource, T
extends BaseT
 
     protected void detach(Error error, boolean close)
     {
+        if (error != null && !getSession().isSyntheticError(error))
+        {
+            _errored = true;
+        }
+
         //TODO: QPID-7954: improve detach
         switch (_state)
         {
@@ -564,6 +571,11 @@ public abstract class AbstractLinkEndpoint<S extends BaseSource, T
extends BaseT
         _capabilities = capabilities == null ? null : capabilities.toArray(new Symbol[capabilities.size()]);
     }
 
+    public boolean isErrored()
+    {
+        return _errored;
+    }
+
     @Override
     public String toString()
     {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/6a7633d0/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractReceivingLinkEndpoint.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractReceivingLinkEndpoint.java
b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractReceivingLinkEndpoint.java
index 00264b7..7423187 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractReceivingLinkEndpoint.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AbstractReceivingLinkEndpoint.java
@@ -39,10 +39,12 @@ import org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionError;
 import org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionalState;
 import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Attach;
+import org.apache.qpid.server.protocol.v1_0.type.transport.End;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Error;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Flow;
 import org.apache.qpid.server.protocol.v1_0.type.transport.ReceiverSettleMode;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Role;
+import org.apache.qpid.server.protocol.v1_0.type.transport.SessionError;
 import org.apache.qpid.server.protocol.v1_0.type.transport.Transfer;
 
 public abstract class AbstractReceivingLinkEndpoint<T extends BaseTarget> extends AbstractLinkEndpoint<Source,
T>
@@ -75,7 +77,7 @@ public abstract class AbstractReceivingLinkEndpoint<T extends BaseTarget>
extend
 
     void receiveTransfer(final Transfer transfer)
     {
-        if(isAttached())
+        if (!isErrored())
         {
             Error error = validateTransfer(transfer);
             if (error != null)
@@ -149,8 +151,11 @@ public abstract class AbstractReceivingLinkEndpoint<T extends BaseTarget>
extend
         }
         else
         {
-            // TODO: it is wrong
-            getSession().updateDisposition(Role.RECEIVER, transfer.getDeliveryId(), transfer.getDeliveryId(),null,
true);
+            End end = new End();
+            end.setError(new Error(SessionError.ERRANT_LINK,
+                                   String.format("Received TRANSFER for link handle %s which
is in errored state.",
+                                                 transfer.getHandle())));
+            getSession().end(end);
         }
     }
 


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


Mime
View raw message