You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2020/08/04 18:57:57 UTC

[qpid-dispatch] 11/32: Dataplane: connection-activate is now routed through the protocol adapter that handles the connection.

This is an automated email from the ASF dual-hosted git repository.

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

commit f91328c3b80f9c908f93b44dfd14749ee7a209a1
Author: Ted Ross <tr...@apache.org>
AuthorDate: Wed Jun 3 15:16:56 2020 -0400

    Dataplane: connection-activate is now routed through the protocol adapter that handles the connection.
---
 src/router_core/router_core.c         | 1 +
 src/router_core/router_core_private.h | 1 +
 src/router_core/router_core_thread.c  | 4 +---
 src/router_node.c                     | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/router_core/router_core.c b/src/router_core/router_core.c
index 31ae0ad..25c124a 100644
--- a/src/router_core/router_core.c
+++ b/src/router_core/router_core.c
@@ -945,6 +945,7 @@ qdr_protocol_adaptor_t *qdr_protocol_adaptor(qdr_core_t                *core,
     DEQ_ITEM_INIT(adaptor);
     adaptor->name                    = name;
     adaptor->user_context            = context;
+    adaptor->activate_handler        = activate;
     adaptor->first_attach_handler    = first_attach;
     adaptor->second_attach_handler   = second_attach;
     adaptor->detach_handler          = detach;
diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h
index 7d8e09e..ac123e5 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -794,6 +794,7 @@ struct qdr_protocol_adaptor_t {
     // Callbacks
     //
     void                     *user_context;
+    qdr_connection_activate_t activate_handler;
     qdr_link_first_attach_t   first_attach_handler;
     qdr_link_second_attach_t  second_attach_handler;
     qdr_link_detach_t         detach_handler;
diff --git a/src/router_core/router_core_thread.c b/src/router_core/router_core_thread.c
index cc73d01..f55d67e 100644
--- a/src/router_core/router_core_thread.c
+++ b/src/router_core/router_core_thread.c
@@ -86,9 +86,7 @@ static void qdr_activate_connections_CT(qdr_core_t *core)
     while (conn) {
         DEQ_REMOVE_HEAD_N(ACTIVATE, core->connections_to_activate);
         conn->in_activate_list = false;
-        sys_mutex_lock(qd_server_get_activation_lock(core->qd->server));
-        qd_server_activate((qd_connection_t*) qdr_connection_get_context(conn));
-        sys_mutex_unlock(qd_server_get_activation_lock(core->qd->server));
+        conn->protocol_adaptor->activate_handler(conn->protocol_adaptor->user_context, conn);
         conn = DEQ_HEAD(core->connections_to_activate);
     }
 }
diff --git a/src/router_node.c b/src/router_node.c
index 304fb4a..70622c6 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -1499,11 +1499,15 @@ qd_router_t *qd_router(qd_dispatch_t *qd, qd_router_mode_t mode, const char *are
 
 static void CORE_connection_activate(void *context, qdr_connection_t *conn)
 {
+    qd_router_t *router = (qd_router_t*) context;
+
     //
     // IMPORTANT:  This is the only core callback that is invoked on the core
     //             thread itself. It must not take locks that could deadlock the core.
     //
+    sys_mutex_lock(qd_server_get_activation_lock(router->qd->server));
     qd_server_activate((qd_connection_t*) qdr_connection_get_context(conn));
+    sys_mutex_unlock(qd_server_get_activation_lock(router->qd->server));
 }
 
 


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