Github user ganeshmurthy commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/74#discussion_r63246808
  
    --- Diff: src/router_core/forwarder.c ---
    @@ -559,20 +559,34 @@ bool qdr_forward_link_balanced_CT(qdr_core_t     
*core,
             //
             // Look for a next-hop we can use to forward the link-attach.
             //
    -        int         router_bit;
             qdr_node_t *next_node;
     
    -        if (qd_bitmask_first_set(addr->rnodes, &router_bit)) {
    -            qdr_node_t *rnode = core->routers_by_mask_bit[router_bit];
    -            if (rnode) {
    -                if (rnode->next_hop)
    -                    next_node = rnode->next_hop;
    -                else
    -                    next_node = rnode;
    +        if (addr->cost_epoch != core->cost_epoch) {
    +            addr->next_remote = -1;
    +            addr->cost_epoch  = core->cost_epoch;
    +        }
     
    -                if (next_node && next_node->peer_data_link)
    -                    conn = next_node->peer_data_link->conn;
    -            }
    +        if (addr->next_remote < 0) {
    +            qd_bitmask_first_set(addr->rnodes, &addr->next_remote);
    --- End diff --
    
    How about I check addr->next_remote >= 0 like below
    
            qdr_node_t *next_node;
    
            if (addr->cost_epoch != core->cost_epoch) {
                addr->next_remote = -1;
                addr->cost_epoch  = core->cost_epoch;
            }
    
            if (addr->next_remote < 0) {
                qd_bitmask_first_set(addr->rnodes, &addr->next_remote);
            }
            
            if (addr->next_remote >= 0) {
    
                qdr_node_t *rnode = 
core->routers_by_mask_bit[addr->next_remote];
        
                if (rnode) {
                    //
                    // Advance the addr->next_remote so there will be link 
balance across containers
                    //
                    _qdbm_next(addr->rnodes, &addr->next_remote);
                    if (addr->next_remote == -1)
                        qd_bitmask_first_set(addr->rnodes, &addr->next_remote);
        
                    if (rnode->next_hop)
                        next_node = rnode->next_hop;
                    else
                        next_node = rnode;
        
                    if (next_node && next_node->peer_data_link)
                        conn = next_node->peer_data_link->conn;
                }
            }


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to