Repository: qpid-dispatch Updated Branches: refs/heads/master e8a915648 -> 667fab328
DISPATCH-802 - Additional fixes - 1. Modified error name to amqp:precondition-failed. 2. Modified error description 3. Prevented from setting the target on the return attach Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/667fab32 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/667fab32 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/667fab32 Branch: refs/heads/master Commit: 667fab3282a20c96e2a741914b8cbfedd075d041 Parents: e8a9156 Author: Ganesh Murthy <gmur...@redhat.com> Authored: Wed Aug 23 13:23:41 2017 -0400 Committer: Ganesh Murthy <gmur...@redhat.com> Committed: Wed Aug 23 13:23:41 2017 -0400 ---------------------------------------------------------------------- src/router_core/connections.c | 11 ++++++----- src/router_core/router_core_private.h | 2 +- src/router_core/terminus.c | 5 ++++- tests/system_tests_one_router.py | 7 ++++--- 4 files changed, 15 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/667fab32/src/router_core/connections.c ---------------------------------------------------------------------- diff --git a/src/router_core/connections.c b/src/router_core/connections.c index 5638c3a..42489bc 100644 --- a/src/router_core/connections.c +++ b/src/router_core/connections.c @@ -866,9 +866,9 @@ void qdr_link_outbound_detach_CT(qdr_core_t *core, qdr_link_t *link, qdr_error_t work->error = qdr_error("qd:connection-role", "Link attach forbidden on inter-router connection"); break; - case QDR_CONDITION_COORDINATOR_NOT_FOUND: - work->error = qdr_error(QD_AMQP_COND_NOT_FOUND, "Link attach forbidden, there is no route to a coordinator, " - "the router cannot coordinate transactions by itself. Try setting up a linkRoute to a coordinator and try again"); + case QDR_CONDITION_COORDINATOR_PRECONDITION_FAILED: + work->error = qdr_error(QD_AMQP_COND_PRECONDITION_FAILED, "The router can't coordinate transactions by itself, a " + "linkRoute to a coordinator must be configured to use transactions."); break; case QDR_CONDITION_NONE: @@ -1399,8 +1399,9 @@ static void qdr_link_inbound_first_attach_CT(qdr_core_t *core, qdr_action_t *act // The router should reject this link because the router cannot coordinate transactions itself. // // The attach response should have a null target to indicate refusal and the immediately coming detach. - // Now, send back a detach with the error amqp:not-found - qdr_link_outbound_detach_CT(core, link, 0, QDR_CONDITION_COORDINATOR_NOT_FOUND, true); + qdr_link_outbound_second_attach_CT(core, link, source, 0); + // Now, send back a detach with the error amqp:precondition-failed + qdr_link_outbound_detach_CT(core, link, 0, QDR_CONDITION_COORDINATOR_PRECONDITION_FAILED, true); } else { http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/667fab32/src/router_core/router_core_private.h ---------------------------------------------------------------------- diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h index 0b52283..b6fd6ea 100644 --- a/src/router_core/router_core_private.h +++ b/src/router_core/router_core_private.h @@ -48,7 +48,7 @@ typedef enum { QDR_CONDITION_ROUTED_LINK_LOST, QDR_CONDITION_FORBIDDEN, QDR_CONDITION_WRONG_ROLE, - QDR_CONDITION_COORDINATOR_NOT_FOUND, + QDR_CONDITION_COORDINATOR_PRECONDITION_FAILED, QDR_CONDITION_NONE } qdr_condition_t; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/667fab32/src/router_core/terminus.c ---------------------------------------------------------------------- diff --git a/src/router_core/terminus.c b/src/router_core/terminus.c index 62012f3..713591a 100644 --- a/src/router_core/terminus.c +++ b/src/router_core/terminus.c @@ -91,8 +91,11 @@ void qdr_terminus_free(qdr_terminus_t *term) void qdr_terminus_copy(qdr_terminus_t *from, pn_terminus_t *to) { - if (!from) + if (!from) { + pn_terminus_set_type(to, PN_UNSPECIFIED); return; + } + if (from->coordinator) { pn_terminus_set_type(to, PN_COORDINATOR); pn_data_copy(pn_terminus_capabilities(to), from->capabilities); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/667fab32/tests/system_tests_one_router.py ---------------------------------------------------------------------- diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py index 2f12670..7ff5656 100644 --- a/tests/system_tests_one_router.py +++ b/tests/system_tests_one_router.py @@ -1625,8 +1625,8 @@ class RejectCoordinatorTest(MessagingHandler, TransactionHandler): def __init__(self, url): super(RejectCoordinatorTest, self).__init__(prefetch=0) self.url = Url(url) - self.error = "Link attach forbidden, there is no route to a coordinator, the router cannot coordinate " \ - "transactions by itself. Try setting up a linkRoute to a coordinator and try again" + self.error = "The router can't coordinate transactions by itself, a linkRoute to a coordinator must be " \ + "configured to use transactions." self.container = None self.conn = None self.sender = None @@ -1659,7 +1659,8 @@ class RejectCoordinatorTest(MessagingHandler, TransactionHandler): link = event.link # If the link name is 'txn-ctrl' and there is a link error and it matches self.error, then we know # that the router has rejected the link because it cannot coordinate transactions itself - if link.name == "txn-ctrl" and link.remote_condition.description == self.error: + if link.name == "txn-ctrl" and link.remote_condition.description == self.error and \ + link.remote_condition.name == 'amqp:precondition-failed': self.link_error = True self.check_if_done() --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org