[GitHub] qpid-dispatch pull request #359: DISPATCH-1100: add auto delete linkRoutes

2018-08-24 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/qpid-dispatch/pull/359


---

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



[GitHub] qpid-dispatch pull request #359: DISPATCH-1100: add auto delete linkRoutes

2018-08-24 Thread kgiusti
Github user kgiusti commented on a diff in the pull request:

https://github.com/apache/qpid-dispatch/pull/359#discussion_r212738886
  
--- Diff: src/router_core/route_control.c ---
@@ -189,37 +189,40 @@ static void qdr_link_route_activate_CT(qdr_core_t 
*core, qdr_link_route_t *lr, q
 // activation for this address, notify the router module of the added 
address.
 //
 if (lr->addr) {
+lr->active_ct += 1;
 qdr_add_connection_ref(&lr->addr->conns, conn);
-if (DEQ_SIZE(lr->addr->conns) == 1) {
+if (lr->active_ct == 1) {
 address = qdr_link_route_pattern_to_address(lr->pattern, 
lr->dir);
 qd_log(core->log, QD_LOG_TRACE, "Activating link route pattern 
[%s]", address);
 qdr_post_mobile_added_CT(core, address);
 free(address);
 }
 }
-
-lr->active = true;
 }
 
 
+// note that this function may free the qdr_link_route_t
 static void qdr_link_route_deactivate_CT(qdr_core_t *core, 
qdr_link_route_t *lr, qdr_connection_t *conn)
 {
 qdr_route_log_CT(core, "Link Route Deactivated", lr->name, 
lr->identity, conn);
 
 //
 // Deactivate the address(es) for link-routed destinations.
 //
-if (lr->addr) {
-qdr_del_connection_ref(&lr->addr->conns, conn);
-if (DEQ_IS_EMPTY(lr->addr->conns)) {
+if (lr->addr && qdr_del_connection_ref(&lr->addr->conns, conn)) {
+assert(lr->active_ct > 0);
+lr->active_ct -= 1;
+if (lr->active_ct == 0) {
 char *address = qdr_link_route_pattern_to_address(lr->pattern, 
lr->dir);
 qd_log(core->log, QD_LOG_TRACE, "Deactivating link route 
pattern [%s]", address);
--- End diff --

not at that point, no.  If the lr is not configured delete-on-close then 
the lr is simply deactivated (not deleted) at that point.

if the lr is delete-on-close it will deactivate first, then the call to 
qdr_route_del_link_route_CT will log a trace message that the link route has 
been removed.


---

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



[GitHub] qpid-dispatch pull request #359: DISPATCH-1100: add auto delete linkRoutes

2018-08-24 Thread ganeshmurthy
Github user ganeshmurthy commented on a diff in the pull request:

https://github.com/apache/qpid-dispatch/pull/359#discussion_r212737548
  
--- Diff: src/router_core/route_control.c ---
@@ -189,37 +189,40 @@ static void qdr_link_route_activate_CT(qdr_core_t 
*core, qdr_link_route_t *lr, q
 // activation for this address, notify the router module of the added 
address.
 //
 if (lr->addr) {
+lr->active_ct += 1;
 qdr_add_connection_ref(&lr->addr->conns, conn);
-if (DEQ_SIZE(lr->addr->conns) == 1) {
+if (lr->active_ct == 1) {
 address = qdr_link_route_pattern_to_address(lr->pattern, 
lr->dir);
 qd_log(core->log, QD_LOG_TRACE, "Activating link route pattern 
[%s]", address);
 qdr_post_mobile_added_CT(core, address);
 free(address);
 }
 }
-
-lr->active = true;
 }
 
 
+// note that this function may free the qdr_link_route_t
 static void qdr_link_route_deactivate_CT(qdr_core_t *core, 
qdr_link_route_t *lr, qdr_connection_t *conn)
 {
 qdr_route_log_CT(core, "Link Route Deactivated", lr->name, 
lr->identity, conn);
 
 //
 // Deactivate the address(es) for link-routed destinations.
 //
-if (lr->addr) {
-qdr_del_connection_ref(&lr->addr->conns, conn);
-if (DEQ_IS_EMPTY(lr->addr->conns)) {
+if (lr->addr && qdr_del_connection_ref(&lr->addr->conns, conn)) {
+assert(lr->active_ct > 0);
+lr->active_ct -= 1;
+if (lr->active_ct == 0) {
 char *address = qdr_link_route_pattern_to_address(lr->pattern, 
lr->dir);
 qd_log(core->log, QD_LOG_TRACE, "Deactivating link route 
pattern [%s]", address);
--- End diff --

Should this log message say "Deleting" instead of "Deactivating" ?


---

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



[GitHub] qpid-dispatch pull request #359: DISPATCH-1100: add auto delete linkRoutes

2018-08-10 Thread kgiusti
GitHub user kgiusti opened a pull request:

https://github.com/apache/qpid-dispatch/pull/359

DISPATCH-1100: add auto delete linkRoutes



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/kgiusti/dispatch DISPATCH-1100

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/qpid-dispatch/pull/359.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #359


commit 305822fd9e5ca595c06eedb324b9a966ccdc83ce
Author: Kenneth Giusti 
Date:   2018-08-03T14:57:43Z

DISPATCH-1100: add auto delete linkRoutes




---

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