peerSelectDnsResults IP cycling problem

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Sat, 01 Feb 2014 17:59:20 -0700

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?

Thank you,

Alex.
Received on Sun Feb 02 2014 - 00:59:44 MST

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