qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kgiusti <...@git.apache.org>
Subject [GitHub] qpid-dispatch pull request #359: DISPATCH-1100: add auto delete linkRoutes
Date Fri, 24 Aug 2018 19:56:34 GMT
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-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message