Repository: qpid-dispatch Updated Branches: refs/heads/master f324804ac -> 4486bbd21
Revert "DISPATCH-357 - Patch from Ganesh Murthy - Expose link address for link-routed links." This reverts commit 29e154dcbbc931e73adf1d0b60a970cd37c90d9d. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/4486bbd2 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/4486bbd2 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/4486bbd2 Branch: refs/heads/master Commit: 4486bbd2103c403335940f4b5cd504e5eebf38cf Parents: f324804 Author: Ted Ross <[email protected]> Authored: Mon Jul 18 14:14:23 2016 -0400 Committer: Ted Ross <[email protected]> Committed: Mon Jul 18 14:16:24 2016 -0400 ---------------------------------------------------------------------- src/router_core/agent_link.c | 6 -- src/router_core/connections.c | 41 +-------- src/router_core/forwarder.c | 1 - src/router_core/router_core_private.h | 2 - tests/system_tests_link_routes.py | 138 ++--------------------------- 5 files changed, 9 insertions(+), 179 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4486bbd2/src/router_core/agent_link.c ---------------------------------------------------------------------- diff --git a/src/router_core/agent_link.c b/src/router_core/agent_link.c index 4691c4a..3b99326 100644 --- a/src/router_core/agent_link.c +++ b/src/router_core/agent_link.c @@ -109,12 +109,6 @@ static void qdr_agent_write_column_CT(qd_composed_field_t *body, int col, qdr_li break; case QDR_LINK_OWNING_ADDR: - if(link->terminus_addr) - qd_compose_insert_string(body, link->terminus_addr); - else - if (link->connected_link && link->connected_link->terminus_addr) - qd_compose_insert_string(body, link->connected_link->terminus_addr); - else if (link->owning_addr) qd_compose_insert_string(body, address_key(link->owning_addr)); else http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4486bbd2/src/router_core/connections.c ---------------------------------------------------------------------- diff --git a/src/router_core/connections.c b/src/router_core/connections.c index d327b95..701a91b 100644 --- a/src/router_core/connections.c +++ b/src/router_core/connections.c @@ -55,12 +55,6 @@ qdr_terminus_t *qdr_terminus_router_data(void) // Interface Functions //================================================================================== -void qdr_link_free(qdr_link_t *link) -{ - free(link->terminus_addr); - free_qdr_link_t(link); -} - qdr_connection_t *qdr_connection_opened(qdr_core_t *core, bool incoming, qdr_connection_role_t role, @@ -153,7 +147,7 @@ int qdr_connection_process(qdr_connection_t *conn) core->detach_handler(core->user_context, work->link, work->error, false); if (work->error) qdr_error_free(work->error); - qdr_link_free(work->link); + free_qdr_link_t(work->link); break; } @@ -291,7 +285,6 @@ qdr_link_t *qdr_link_first_attach(qdr_connection_t *conn, link->capacity = conn->link_capacity; link->admin_enabled = true; link->oper_status = QDR_LINK_OPER_DOWN; - link->terminus_addr = 0; link->strip_annotations_in = conn->strip_annotations_in; link->strip_annotations_out = conn->strip_annotations_out; @@ -567,7 +560,6 @@ qdr_link_t *qdr_create_link_CT(qdr_core_t *core, qdr_generate_link_name("qdlink", link->name, QDR_DISCRIMINATOR_SIZE + 8); link->admin_enabled = true; link->oper_status = QDR_LINK_OPER_DOWN; - link->terminus_addr = 0; link->strip_annotations_in = conn->strip_annotations_in; link->strip_annotations_out = conn->strip_annotations_out; @@ -959,7 +951,7 @@ static void qdr_connection_closed_CT(qdr_core_t *core, qdr_action_t *action, boo // Clean up the link and all its associated state. // qdr_link_cleanup_CT(core, conn, link); // link_cleanup disconnects and frees the ref. - qdr_link_free(link); + free_qdr_link_t(link); link_ref = DEQ_HEAD(conn->links); } @@ -981,28 +973,6 @@ static void qdr_connection_closed_CT(qdr_core_t *core, qdr_action_t *action, boo free_qdr_connection_t(conn); } -/** - * Sets the terminus address in the case of a link routed attach. - */ -static void set_terminus_address(qdr_link_t *link, qd_direction_t dir) -{ - qd_link_t *qd_link = (qd_link_t *) qdr_link_get_context(link); - char *terminus_addr = 0; - if (dir == QD_INCOMING) { - terminus_addr = (char*)pn_terminus_get_address(pn_link_remote_target((pn_link_t *)qd_link_pn(qd_link))); - } - else { - terminus_addr = (char*)pn_terminus_get_address(pn_link_remote_source((pn_link_t *)qd_link_pn(qd_link))); - } - - if (terminus_addr) { - char *term_addr = malloc((strlen(terminus_addr) + 3) * sizeof(char)); - term_addr[0] = '\0'; - strcat(term_addr, "M0"); - strcat(term_addr, terminus_addr); - link->terminus_addr = term_addr; - } -} static void qdr_link_inbound_first_attach_CT(qdr_core_t *core, qdr_action_t *action, bool discard) { @@ -1075,7 +1045,6 @@ static void qdr_link_inbound_first_attach_CT(qdr_core_t *core, qdr_action_t *act // // This is a link-routed destination, forward the attach to the next hop // - set_terminus_address(link, dir); success = qdr_forward_attach_CT(core, addr, link, source, target); if (!success) { qdr_link_outbound_detach_CT(core, link, 0, QDR_CONDITION_NO_ROUTE_TO_DESTINATION); @@ -1129,13 +1098,11 @@ static void qdr_link_inbound_first_attach_CT(qdr_core_t *core, qdr_action_t *act qdr_terminus_free(target); } - else if (link_route) { + else if (link_route) // // This is a link-routed destination, forward the attach to the next hop // - set_terminus_address(link, dir); qdr_forward_attach_CT(core, addr, link, source, target); - } else { // @@ -1354,7 +1321,7 @@ static void qdr_link_inbound_detach_CT(qdr_core_t *core, qdr_action_t *action, b qdr_link_outbound_detach_CT(core, link, 0, QDR_CONDITION_NONE); } else { qdr_link_cleanup_CT(core, conn, link); - qdr_link_free(link); + free_qdr_link_t(link); } // http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4486bbd2/src/router_core/forwarder.c ---------------------------------------------------------------------- diff --git a/src/router_core/forwarder.c b/src/router_core/forwarder.c index d32c8dd..2c6517b 100644 --- a/src/router_core/forwarder.c +++ b/src/router_core/forwarder.c @@ -644,7 +644,6 @@ bool qdr_forward_link_balanced_CT(qdr_core_t *core, out_link->link_direction = qdr_link_direction(in_link) == QD_OUTGOING ? QD_INCOMING : QD_OUTGOING; out_link->admin_enabled = true; out_link->oper_status = QDR_LINK_OPER_DOWN; - out_link->terminus_addr = 0; out_link->name = (char*) malloc(strlen(in_link->name) + 1); strcpy(out_link->name, in_link->name); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4486bbd2/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 69aaec4..3113165 100644 --- a/src/router_core/router_core_private.h +++ b/src/router_core/router_core_private.h @@ -251,7 +251,6 @@ struct qdr_link_t { qd_link_type_t link_type; qd_direction_t link_direction; char *name; - char *terminus_addr; /// CAUTION - The terminus_addr holds the full address of the link route. Used only for link routes int detach_count; ///< 0, 1, or 2 depending on the state of the lifecycle qdr_address_t *owning_addr; ///< [ref] Address record that owns this link qdr_link_t *connected_link; ///< [ref] If this is a link-route, reference the connected link @@ -593,7 +592,6 @@ void qdr_action_enqueue(qdr_core_t *core, qdr_action_t *action); void qdr_link_issue_credit_CT(qdr_core_t *core, qdr_link_t *link, int credit, bool drain); void qdr_addr_start_inlinks_CT(qdr_core_t *core, qdr_address_t *addr); void qdr_delivery_push_CT(qdr_core_t *core, qdr_delivery_t *dlv); -void qdr_link_free(qdr_link_t *link); void qdr_delivery_release_CT(qdr_core_t *core, qdr_delivery_t *delivery); void qdr_delivery_failed_CT(qdr_core_t *core, qdr_delivery_t *delivery); bool qdr_delivery_settled_CT(qdr_core_t *core, qdr_delivery_t *delivery); http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/4486bbd2/tests/system_tests_link_routes.py ---------------------------------------------------------------------- diff --git a/tests/system_tests_link_routes.py b/tests/system_tests_link_routes.py index 6696cc0..1c080cf 100644 --- a/tests/system_tests_link_routes.py +++ b/tests/system_tests_link_routes.py @@ -505,23 +505,6 @@ class LinkRoutePatternTest(TestCase): drain_support.run() self.assertEqual(None, drain_support.error) - def test_link_route_terminus_address(self): - # The receiver is attaching to router B to a listener that has link route for address 'pulp.task' setup. - listening_address = self.routers[1].addresses[1] - # Run the query on a normal port - query_address_listening = self.routers[1].addresses[0] - - # Sender is attaching to router C - sender_address = self.routers[2].addresses[0] - query_address_sending = self.routers[2].addresses[0] - - test = TerminusAddrTest(sender_address, listening_address, query_address_sending, query_address_listening) - test.run() - - self.assertTrue(test.in_receiver_found) - self.assertTrue(test.out_receiver_found) - self.assertTrue(test.in_sender_found) - self.assertTrue(test.out_sender_found) class DeliveryTagsTest(MessagingHandler): def __init__(self, sender_address, listening_address, qdstat_address): @@ -601,11 +584,11 @@ class Timeout(object): class CloseWithUnsettledTest(MessagingHandler): - """ - This test sends a message across an attach-routed link. While the message - is unsettled, the client link is closed. The test is ensuring that the - router does not crash during the closing of the links. - """ + ## + ## This test sends a message across an attach-routed link. While the message + ## is unsettled, the client link is closed. The test is ensuring that the + ## router does not crash during the closing of the links. + ## def __init__(self, normal_addr, route_addr): super(CloseWithUnsettledTest, self).__init__(prefetch=0, auto_accept=False) self.normal_addr = normal_addr @@ -647,117 +630,6 @@ class CloseWithUnsettledTest(MessagingHandler): def run(self): Container(self).run() -class TerminusAddrTest(MessagingHandler): - """ - This tests makes sure that the link route address is visible in the output of qdstat -l command. - - Sets up a sender on address pulp.task.terminusTestSender and a receiver on pulp.task.terminusTestReceiver. - Connects to the router to which the sender is attached and makes sure that the pulp.task.terminusTestSender address - shows up with an 'in' and 'out' - Similarly connects to the router to which the receiver is attached and makes sure that the - pulp.task.terminusTestReceiver address shows up with an 'in' and 'out' - - """ - def __init__(self, sender_address, listening_address, query_address_sending, query_address_listening): - super(TerminusAddrTest, self).__init__() - self.sender_address = sender_address - self.listening_address = listening_address - self.sender = None - self.receiver = None - self.message_received = False - self.receiver_connection = None - self.sender_connection = None - # We will run a query on the same router where the sender is attached - self.query_address_sending = query_address_sending - - # We will run a query on the same router where the receiver is attached - self.query_address_listening = query_address_listening - self.count = 0 - - self.in_receiver_found = False - self.out_receiver_found = False - self.in_sender_found = False - self.out_sender_found = False - - self.receiver_link_opened = False - self.sender_link_opened = False - - def on_start(self, event): - self.receiver_connection = event.container.connect(self.listening_address) - - def on_connection_remote_open(self, event): - if event.connection == self.receiver_connection: - continue_loop = True - # The following loops introduces a wait. It gives time to the - # router so that the address Dpulp.task can show up on the remoteCount - i = 0 - while continue_loop: - if i > 100: # If we have run the read command for more than hundred times and we still do not have - # the remoteCount set to 1, there is a problem, just exit out of the function instead - # of looping to infinity. - self.receiver_connection.close() - return - local_node = Node.connect(self.query_address_sending, timeout=TIMEOUT) - out = local_node.read(type='org.apache.qpid.dispatch.router.address', name='Dpulp.task').remoteCount - if out == 1: - continue_loop = False - i += 1 - sleep(0.25) - - self.sender_connection = event.container.connect(self.sender_address) - - # Notice here that the receiver and sender are listening on different addresses. Receiver on - # pulp.task.terminusTestReceiver and the sender on pulp.task.terminusTestSender - self.receiver = event.container.create_receiver(self.receiver_connection, "pulp.task.terminusTestReceiver") - self.sender = event.container.create_sender(self.sender_connection, "pulp.task.terminusTestSender", options=AtMostOnce()) - - def on_link_opened(self, event): - if event.receiver == self.receiver: - self.receiver_link_opened = True - - local_node = Node.connect(self.query_address_listening, timeout=TIMEOUT) - out = local_node.query(type='org.apache.qpid.dispatch.router.link') - - link_dir_index = out.attribute_names.index("linkDir") - owning_addr_index = out.attribute_names.index("owningAddr") - - # Make sure that the owningAddr M0pulp.task.terminusTestReceiver shows up on both in and out. - # The 'out' link is on address M0pulp.task.terminusTestReceiver outgoing from the router B to the receiver - # The 'in' link is on address M0pulp.task.terminusTestReceiver incoming from router C to router B - for result in out.results: - if result[link_dir_index] == 'in' and result[owning_addr_index] == 'M0pulp.task.terminusTestReceiver': - self.in_receiver_found = True - if result[link_dir_index] == 'out' and result[owning_addr_index] == 'M0pulp.task.terminusTestReceiver': - self.out_receiver_found = True - - if event.sender == self.sender: - self.sender_link_opened = True - - local_node = Node.connect(self.query_address_sending, timeout=TIMEOUT) - out = local_node.query(type='org.apache.qpid.dispatch.router.link') - - link_dir_index = out.attribute_names.index("linkDir") - owning_addr_index = out.attribute_names.index("owningAddr") - - # Make sure that the owningAddr M0pulp.task.terminusTestSender shows up on both in and out. - # The 'in' link is on address M0pulp.task.terminusTestSender incoming from sender to router - # The 'out' link is on address M0pulp.task.terminusTestSender outgoing from router C to router B - for result in out.results: - if result[link_dir_index] == 'in' and result[owning_addr_index] == 'M0pulp.task.terminusTestSender': - self.in_sender_found = True - if result[link_dir_index] == 'out' and result[owning_addr_index] == 'M0pulp.task.terminusTestSender': - self.out_sender_found = True - - # Shutdown the connections only if the on_link_opened has been called for sender and receiver links. - if self.sender_link_opened and self.receiver_link_opened: - self.sender.close() - self.receiver.close() - self.sender_connection.close() - self.receiver_connection.close() - - def run(self): - Container(self).run() - if __name__ == '__main__': unittest.main(main_module()) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
