jiridanek commented on a change in pull request #1191:
URL: https://github.com/apache/qpid-dispatch/pull/1191#discussion_r627728440



##########
File path: src/router_core/router_core.c
##########
@@ -236,6 +236,33 @@ void qdr_core_free(qdr_core_t *core)
         link = DEQ_HEAD(core->open_links);
     }
 
+    // finalize modules while we can still submit new actions
+    // this must happen after qdrc_endpoint_do_cleanup_CT calls
+    qdr_modules_finalize(core);
+
+    // discard any left over actions
+
+    qdr_action_list_t  action_list;
+    DEQ_MOVE(core->action_list, action_list);
+    DEQ_APPEND(action_list, core->action_list_background);
+    qdr_action_t *action = DEQ_HEAD(action_list);
+    while (action) {
+        DEQ_REMOVE_HEAD(action_list);
+        action->action_handler(core, action, true);
+        free_qdr_action_t(action);
+        action = DEQ_HEAD(action_list);
+    }
+
+    // Drain the general work lists
+    qdr_general_handler(core);
+
+    sys_thread_free(core->thread);
+    sys_cond_free(core->action_cond);
+    sys_mutex_free(core->action_lock);
+    sys_mutex_free(core->work_lock);
+    sys_mutex_free(core->id_lock);
+    qd_timer_free(core->work_timer);
+
     //
     // Clean up any qdr_delivery_cleanup_t's that are still left in the 
core->delivery_cleanup_list
     //

Review comment:
       @ganeshmurthy are you suggesting this to make the diff size smaller? or 
is there more to it?
   
   Here I am instead moving the qdr_modules_finalize (and the action discarding 
loop) in front of qdr_delivery_cleanup_t's cleanup. It made sense to me that 
way too. (And I moved the code that frees the locks back up, because 
previously, that was early on in the body of the function, before I started 
messing with it)




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to