Re: peerSelectDnsResults IP cycling problem

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 02 Feb 2014 14:37:48 +1300

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
Received on Sun Feb 02 2014 - 01:37:54 MST

This archive was generated by hypermail 2.2.0 : Sun Feb 02 2014 - 12:00:09 MST