qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject qpid-dispatch git commit: DISPATCH-168 - Handle case where management request has no reply-to. Generally handle internal sends with no address. Added a test for the no reply-to case.
Date Fri, 11 Sep 2015 15:25:05 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master a0bd62339 -> 2e1bf7eeb


DISPATCH-168 - Handle case where management request has no reply-to.
               Generally handle internal sends with no address.
               Added a test for the no reply-to case.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/2e1bf7ee
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/2e1bf7ee
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/2e1bf7ee

Branch: refs/heads/master
Commit: 2e1bf7eeb57763e7ca6924a984d4e7f4ad351e2a
Parents: a0bd623
Author: Ted Ross <tross@redhat.com>
Authored: Fri Sep 11 11:23:53 2015 -0400
Committer: Ted Ross <tross@redhat.com>
Committed: Fri Sep 11 11:23:53 2015 -0400

----------------------------------------------------------------------
 .../qpid_dispatch_internal/management/agent.py  |  5 +++++
 src/router_node.c                               |  8 ++++---
 tests/system_tests_one_router.py                | 22 ++++++++++++++++++++
 3 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2e1bf7ee/python/qpid_dispatch_internal/management/agent.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/agent.py b/python/qpid_dispatch_internal/management/agent.py
index 3962b96..d1f9a0a 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@ -646,6 +646,11 @@ class Agent(object):
             """Raise an error"""
             self.log(LOG_ERROR, "Error dispatching %s: %s\n%s"%(request, e, trace))
             self.respond(request, e.status, e.description)
+
+        # If there's no reply_to, don't bother to process the request.
+        if not request.reply_to:
+            return
+
         # Coarse locking, handle one request at a time.
         with self.request_lock:
             try:

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2e1bf7ee/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index fda1c97..e907509 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -2069,7 +2069,9 @@ void qd_router_send2(qd_dispatch_t *qd,
                      const char    *address,
                      qd_message_t  *msg)
 {
-    qd_field_iterator_t *iter = qd_address_iterator_string(address, ITER_VIEW_ADDRESS_HASH);
-    qd_router_send(qd, iter, msg);
-    qd_field_iterator_free(iter);
+    if (address && msg) {
+        qd_field_iterator_t *iter = qd_address_iterator_string(address, ITER_VIEW_ADDRESS_HASH);
+        qd_router_send(qd, iter, msg);
+        qd_field_iterator_free(iter);
+    }
 }

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2e1bf7ee/tests/system_tests_one_router.py
----------------------------------------------------------------------
diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py
index d74e354..79a79ef 100644
--- a/tests/system_tests_one_router.py
+++ b/tests/system_tests_one_router.py
@@ -844,6 +844,28 @@ class RouterTest(TestCase):
         M.stop()
 
 
+    def test_09a_management_no_reply(self):
+        addr  = "amqp:/$management"
+
+        M = self.messenger()
+        M.start()
+        M.route("amqp:/*", self.address+"/$1")
+
+        request  = Message()
+
+        request.address        = addr
+        request.correlation_id = "C1"
+        request.properties     = {u'type':u'org.amqp.management', u'name':u'self', u'operation':u'GET-MGMT-NODES'}
+
+        M.put(request)
+        M.send()
+
+        M.put(request)
+        M.send()
+
+        M.stop()
+
+
     def test_09c_management_get_operations(self):
         addr  = "amqp:/_local/$management"
 


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


Mime
View raw message