On Mon, 18 Sep 2023 23:44:22 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

>> Liam Miller-Cushon has refreshed the contents of this pull request, and 
>> previous commits have been removed. The incremental views will show 
>> differences compared to the previous content of the PR. The pull request 
>> contains one new commit since the last revision:
>> 
>>   JDK-8313804: JDWP support for -Djava.net.preferIPv6Addresses=system
>
> Is the code starting at lines 748 and 970 still correct after your changes?

> Similar to @plummercj comment what about this code at L730:
> 
> ```
> // Try to find bind address of preferred address family first.
>     for (ai = addrInfo; ai != NULL; ai = ai->ai_next) {
>         if (ai->ai_family == preferredAddressFamily) {
>             listenAddr = ai;
>             break;
>         }
>     }
> ```
> 
> with AF_INET or AF_INET6 this would find a match, but with AF_UNSPEC then it 
> seems it will just leave `ai` pointing to the last entry. ???

I think that's covered by the logic that follows it on L738. If that loop fails 
to initialize `listenAddr`, it gets set to the first address, which I think is 
what we want:


    if (listenAddr == NULL) {
        // No address of preferred address family found, grab the first one.
        listenAddr = &(addrInfo[0]);
    }

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15796#issuecomment-1724851382

Reply via email to