Re: [PATCH] PSC callback cleanup

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 03 Apr 2014 18:53:21 +1300

On 3/04/2014 12:37 p.m., Alex Rousskov wrote:
> On 04/02/2014 05:03 AM, Amos Jeffries wrote:
>> This removes the needless Comm::ConnectionList* parameter to the PSC
>> (Peer Select callback) function.
>>
>> The callee state object (data) of PSC is the original owner of the
>> vector "list" being returned so always has direct access to it as a
>> member variable.
>
> I would go the other way around if possible: Make peer selection code
> return the computed destinations list to the caller instead of
> maintaining that destination list as a _shared_ storage object between
> the caller and the peer selection code.
>
> In other words, instead of removing Comm::ConnectionList* parameter from
> the Peer Select callback, I would remove it from the peerSelect() call
> itself (if possible).
>
> If peerSelect() needs an initial set of destinations for some reason,
> then both parameters should stay, but there should be no sharing of
> those two lists (and they can/should be converted from pointers to
> references in this case).

Sure. That would work better, though it means a much larger patch.

Amos
Received on Thu Apr 03 2014 - 05:53:33 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 03 2014 - 12:00:09 MDT