kgiusti commented on a change in pull request #668: DISPATCH-1509: free core 
agent timer on shutdown
URL: https://github.com/apache/qpid-dispatch/pull/668#discussion_r368703605
 
 

 ##########
 File path: src/router_core/agent.c
 ##########
 @@ -107,6 +122,54 @@ static void qdr_agent_set_columns(qdr_query_t *query, 
qd_parsed_field_t *attribu
 // Interface Functions
 
//==================================================================================
 
+
+// called prior to core thread start
+qdr_agent_t *qdr_agent(qdr_core_t *core)
+{
+    qdr_agent_t *agent = NEW(qdr_agent_t);
+    ZERO(agent);
+
+    DEQ_INIT(agent->outgoing_query_list);
+    agent->query_lock  = sys_mutex();
+    agent->agent_timer = qd_timer(core->qd, qdr_agent_response_handler, core);
+    agent->agent_log_source = qd_log_source("AGENT");
+    return agent;
+}
+
+
+// called after core thread has shutdown
+void qdr_agent_free(qdr_agent_t *agent)
+{
+    if (agent) {
+        qd_timer_free(agent->agent_timer);
+        if (agent->query_lock)
+            sys_mutex_free(agent->query_lock);
+
+        //we can't call qdr_core_unsubscribe on the subscriptions because the 
action processing thread has
+        //already been shut down. But, all the action would have done at this 
point is free the subscriptions
+        //so we just do that directly.
+        free(agent->agent_subscription_mobile);
+        free(agent->agent_subscription_local);
+
 
 Review comment:
   Turns out the log module frees all the log sources up on shutdown.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to