qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject [qpid-dispatch] branch dev-protocol-adaptors-2 updated: DISPATCH-1867: Initialize modules and adaptors outside of the core thread so they are ready to go right after the qd_router_setup_late() completes
Date Wed, 09 Dec 2020 18:59:33 GMT
This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch dev-protocol-adaptors-2
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/dev-protocol-adaptors-2 by this push:
     new 760986d  DISPATCH-1867: Initialize modules and adaptors outside of the core thread
so they are ready to go right after the qd_router_setup_late() completes
760986d is described below

commit 760986d88954da75df9bdcdee71ef7e2e553938f
Author: Ganesh Murthy <gmurthy@apache.org>
AuthorDate: Wed Dec 9 11:18:27 2020 -0500

    DISPATCH-1867: Initialize modules and adaptors outside of the core thread so they are
ready to go right after the qd_router_setup_late() completes
---
 src/router_core/router_core.c         | 28 ++++++++++++++++++++++++++++
 src/router_core/router_core_private.h |  3 +++
 src/router_core/router_core_thread.c  |  6 ------
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/src/router_core/router_core.c b/src/router_core/router_core.c
index 779a1f0..b1ad331 100644
--- a/src/router_core/router_core.c
+++ b/src/router_core/router_core.c
@@ -43,6 +43,28 @@ const uint64_t QD_DELIVERY_MOVED_TO_NEW_LINK = 999999999;
 
 static void qdr_general_handler(void *context);
 
+static void qdr_core_setup_init(qdr_core_t *core)
+{
+    //
+    // DISPATCH-1867: These functions used to be called inside the router_core_thread() function
in router_core_thread.c
+    // which meant they were executed asynchronously by the core thread which meant qd_router_setup_late()
could
+    // return before these functions executed in the core thread. But we need the adaptors
and modules to be initialized *before* qd_router_setup_late() completes
+    // so that python can successfully initialize httpConnectors and httpListeners.
+    //
+    qdr_forwarder_setup_CT(core);
+    qdr_route_table_setup_CT(core);
+
+    //
+    // Initialize the core modules
+    //
+    qdr_modules_init(core);
+
+    //
+    // Initialize all registered adaptors (HTTP1, HTTP2, TCP)
+    //
+    qdr_adaptors_init(core);
+}
+
 qdr_core_t *qdr_core(qd_dispatch_t *qd, qd_router_mode_t mode, const char *area, const char
*id)
 {
     qdr_core_t *core = NEW(qdr_core_t);
@@ -88,6 +110,12 @@ qdr_core_t *qdr_core(qd_dispatch_t *qd, qd_router_mode_t mode, const char
*area,
     core->mgmt_agent = qdr_agent(core);
 
     //
+    // Setup and initialize modules, adaptors, address table etc. so we can have everything
initialized and ready to
+    // go when the core thread starts handling actions.
+    //
+    qdr_core_setup_init(core);
+
+    //
     // Launch the core thread
     //
     core->thread = sys_thread(router_core_thread, core);
diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h
index 780605e..191fe33 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -1011,6 +1011,9 @@ qdr_query_t *qdr_query(qdr_core_t              *core,
                        qd_router_entity_type_t  type,
                        qd_composed_field_t     *body,
                        uint64_t                 conn_id);
+
+void qdr_modules_init(qdr_core_t *core);
+void qdr_adaptors_init(qdr_core_t *core);
 void qdr_modules_finalize(qdr_core_t *core);
 void qdr_adaptors_finalize(qdr_core_t *core);
 
diff --git a/src/router_core/router_core_thread.c b/src/router_core/router_core_thread.c
index c6a6c54..9f8b17f 100644
--- a/src/router_core/router_core_thread.c
+++ b/src/router_core/router_core_thread.c
@@ -206,12 +206,6 @@ void *router_core_thread(void *arg)
     qdr_action_list_t  action_list;
     qdr_action_t      *action;
 
-    qdr_forwarder_setup_CT(core);
-    qdr_route_table_setup_CT(core);
-
-    qdr_modules_init(core);
-    qdr_adaptors_init(core);
-
     qd_log(core->log, QD_LOG_INFO, "Router Core thread running. %s/%s", core->router_area,
core->router_id);
     while (core->running) {
         //


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


Mime
View raw message