[ 
https://issues.apache.org/jira/browse/DISPATCH-788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16058141#comment-16058141
 ] 

ASF GitHub Bot commented on DISPATCH-788:
-----------------------------------------

Github user ted-ross commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/169#discussion_r123356457
  
    --- Diff: src/router_core/transfer.c ---
    @@ -412,14 +412,41 @@ static void 
qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t *de
         free_qdr_delivery_t(delivery);
     }
     
    +static bool qdr_delivery_has_peer_CT(qdr_delivery_t *dlv)
    +{
    +    if (!dlv->peer && DEQ_SIZE(dlv->peers) == 0)
    +        return false;
    +    return true;
    +}
    +
     
     void qdr_delivery_link_peers_CT(qdr_delivery_t *in_dlv, qdr_delivery_t 
*out_dlv)
     {
    -    assert(!in_dlv->peer);
    -    assert(!out_dlv->peer);
    +    // If there is no delivery or a peer, we cannot link each other.
    +    if (!in_dlv || !out_dlv)
    +        return;
    +
    +    if (!qdr_delivery_has_peer_CT(in_dlv)) {
    +        // This is the very first peer. Link them up.
    +        assert(!out_dlv->peer);
     
    -    out_dlv->peer = in_dlv;
    -    in_dlv->peer = out_dlv;
    +        out_dlv->peer = in_dlv;
    +        in_dlv->peer = out_dlv;
    +    }
    +    else {
    +        if (in_dlv->peer) {
    +            // This is the first time we know that in_dlv is going to have 
more than one peer.
    +            // There is already a peer in the in_dlv->peer pointer, move 
it into a list and zero it out.
    +            qdr_add_delivery_ref_CT(&in_dlv->peers, in_dlv->peer);
    +
    +            // Zero out the peer pointer. Since there is more than one 
peer, this peer has been moved to the "peers" linked list.
    +            // All peers will now reside in the peers linked list. No need 
to decref/incref here because you are transferring ownership.
    +            in_dlv->peer = 0;
    +        }
    +
    +        out_dlv->peer = in_dlv;
    --- End diff --
    
    Minor point:  You repeat this line.  Why not do this once outside of the 
if-then-else.  The condition does not affect the backward linkage from out to 
in.


> Create peer linkage for presettled deliveries so we can use this to handle 
> muticast dispositions
> ------------------------------------------------------------------------------------------------
>
>                 Key: DISPATCH-788
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-788
>             Project: Qpid Dispatch
>          Issue Type: Improvement
>          Components: Container
>    Affects Versions: 0.8.0
>            Reporter: Ganesh Murthy
>            Assignee: Ganesh Murthy
>             Fix For: 1.0.0
>
>
> Right now peer delivieries are not created for presettled messages. Create 
> peers for presettled messages so that this feature can be used to implement 
> several features like message streaming, handling multicast dispositions etc.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to