[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] qpid-dispatch pull request #167: DISPATCH-788 - First attempt at adding a co...

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

    https://github.com/apache/qpid-dispatch/pull/167#discussion_r122776057
 
    --- Diff: src/router_core/transfer.c ---
    @@ -413,6 +413,43 @@ static void qdr_delete_delivery_internal_CT(qdr_core_t *core, qdr_delivery_t *de
     }
     
     
    +void qdr_delivery_link_peers_CT(qdr_delivery_t *in_dlv, qdr_delivery_t *out_dlv)
    +{
    +    if (in_dlv->peer || out_dlv->peer)
    +        // One of the deliveries already has a peer. Don't proceed.
    +        return;
    +
    +    out_dlv->peer = in_dlv;
    +    in_dlv->peer = out_dlv;
    +
    +    qdr_delivery_incref(out_dlv);
    +    qdr_delivery_incref(in_dlv);
    +}
    +
    +
    +void qdr_delivery_unlink_peers_CT(qdr_core_t *core, qdr_delivery_t *dlv, qdr_delivery_t *peer)
    +{
    +    dlv->peer  = 0;
    +    peer->peer = 0;
    +
    +    qdr_delivery_decref_CT(core, dlv);
    --- End diff --
   
    What if these two deliveries weren't linked to one another?  You will cause a data corruption with no indication.  You should assert that the proper mutual linkage is in place before removing it and decrementing reference counts.


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---

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