On 2/02/2014 1:59 p.m., Alex Rousskov wrote:
> Hello,
> 
>     The following peerSelectDnsResults() code appears to care about IP
> address cycling (using all the different cached IP addresses associated
> with a single DNS name). The code reads ia->cur, increments the local ip
> counter on every loop iteration, and checks for wrapping:
> 
>>         // loop over each result address, adding to the possible 
>> destinations.
>>         int ip = ia->cur;
>>         for (int n = 0; n < ia->count; ++n, ++ip) {
>>             Comm::ConnectionPointer p;
>>
>>             if (ip >= ia->count) ip = 0; // looped back to zero.
> 
> 
> However, the local "ip" variable is otherwise unused. We use "n" as an
> address index instead, and n always starts with zero.
> 
> If peerSelectDnsResults() should cycle through IPs, we should use "ip"
> instead of "n". Otherwise, we should remove the local "ip" variable and
> the associated code. Could somebody who knows the answer commit the
> right fix, please?
> 

Applied as trunk rev.13255.

Amos

Reply via email to