You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/05/30 17:17:31 UTC

qpid-dispatch git commit: DISPATCH-777: Restore delayed-activation code in router core.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master b1f09d5ea -> 75cbe215a


DISPATCH-777: Restore delayed-activation code in router core.

Removed in error, required to ensure that connections are not activated
after they have been deleted by the router core thread.


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

Branch: refs/heads/master
Commit: 75cbe215a26e52b9de9eaa2efdb6d0bea4e44927
Parents: b1f09d5
Author: Alan Conway <ac...@redhat.com>
Authored: Tue May 30 13:15:45 2017 -0400
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue May 30 13:15:45 2017 -0400

----------------------------------------------------------------------
 src/router_core/connections.c         | 13 ++++++++++++-
 src/router_core/router_core_private.h |  2 ++
 src/router_core/router_core_thread.c  | 18 ++++++++++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/75cbe215/src/router_core/connections.c
----------------------------------------------------------------------
diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index 277fd37..f0b8d8e 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -491,7 +491,10 @@ void qdr_connection_handlers(qdr_core_t                *core,
 
 void qdr_connection_activate_CT(qdr_core_t *core, qdr_connection_t *conn)
 {
-    qd_server_activate((qd_connection_t*) qdr_connection_get_context(conn));
+    if (!conn->in_activate_list) {
+        DEQ_INSERT_TAIL_N(ACTIVATE, core->connections_to_activate, conn);
+        conn->in_activate_list = true;
+    }
 }
 
 
@@ -1232,6 +1235,14 @@ static void qdr_connection_closed_CT(qdr_core_t *core, qdr_action_t *action, boo
         work = DEQ_HEAD(conn->work_list);
     }
 
+    //
+    // If this connection is on the activation list, remove it from the list
+    //
+    if (conn->in_activate_list) {
+        conn->in_activate_list = false;
+        DEQ_REMOVE_N(ACTIVATE, core->connections_to_activate, conn);
+    }
+
     DEQ_REMOVE(core->open_connections, conn);
     sys_mutex_free(conn->work_lock);
     qdr_connection_free(conn);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/75cbe215/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 ecd4807..07d832b 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -518,6 +518,7 @@ struct qdr_connection_t {
     uint64_t                    identity;
     qdr_core_t                 *core;
     bool                        incoming;
+    bool                        in_activate_list;
     qdr_connection_role_t       role;
     int                         inter_router_cost;
     qdr_conn_identifier_t      *conn_id;
@@ -610,6 +611,7 @@ struct qdr_core_t {
     qd_timer_t              *work_timer;
 
     qdr_connection_list_t open_connections;
+    qdr_connection_list_t connections_to_activate;
     qdr_link_list_t       open_links;
 
     //

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/75cbe215/src/router_core/router_core_thread.c
----------------------------------------------------------------------
diff --git a/src/router_core/router_core_thread.c b/src/router_core/router_core_thread.c
index 926063c..e5b00f5 100644
--- a/src/router_core/router_core_thread.c
+++ b/src/router_core/router_core_thread.c
@@ -29,6 +29,19 @@
 
 ALLOC_DEFINE(qdr_action_t);
 
+
+static void qdr_activate_connections_CT(qdr_core_t *core)
+{
+    qdr_connection_t *conn = DEQ_HEAD(core->connections_to_activate);
+    while (conn) {
+        DEQ_REMOVE_HEAD_N(ACTIVATE, core->connections_to_activate);
+        conn->in_activate_list = false;
+        qd_server_activate((qd_connection_t*) qdr_connection_get_context(conn));
+        conn = DEQ_HEAD(core->connections_to_activate);
+    }
+}
+
+
 void *router_core_thread(void *arg)
 {
     qdr_core_t        *core = (qdr_core_t*) arg;
@@ -71,6 +84,11 @@ void *router_core_thread(void *arg)
             free_qdr_action_t(action);
             action = DEQ_HEAD(action_list);
         }
+
+        //
+        // Activate all connections that were flagged for activation during the above processing
+        //
+        qdr_activate_connections_CT(core);
     }
 
     qd_log(core->log, QD_LOG_INFO, "Router Core thread exited");


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