Hi Alex, Yes, you are right about that. I didn't think about extending the check to more than 127.0.0.1.
The existing macro was only testing for 127.0.0.1 in both IP4 and IP6 modes, so if the consensus is that we want to extend to all of the possible loopback addresses, I can modify the macro to add AND operations to clear the bits before we compare. It would require that we make our own macro for ::1/128, since the Windows SDK only tests for ::1 in IN6_IS_ADDR_LOOPBACK. Thanks. Nikola -----Original Message----- From: Alex Menkov <alexey.men...@oracle.com> Sent: July 22, 2020 6:06 PM To: Nikola Grcevski <nikola.grcev...@microsoft.com>; Alan Bateman <alan.bate...@oracle.com>; net-dev@openjdk.java.net Subject: Re: RFR(s): Improving performance of Windows socket connect on the loopback adapter Hi Nikola, One note. src\java.base\windows\native\libnet\net_util_md.h IN6_IS_ADDR_V4MAPPED_LOOPBACK considers only 127.0.0.1 as loopback address, but AFAIR it's the whole block 127.0.0.0/8 and 127.0.0.1 is just the most common used address. --alex On 07/22/2020 07:14, Nikola Grcevski wrote: > Thanks again Alan. My apologies for the delayed response, I was away most of > yesterday. > > I've updated the webrev with the change as requested: > > https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.open > jdk.java.net%2F~adityam%2Fnikola%2Ffast_connect_loopback_3%2F&data > =02%7C01%7CNikola.Grcevski%40microsoft.com%7C63350fd7858c49245bd008d82 > ea631eb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C63731063861947745 > 6&sdata=bzL%2B52BrS1vCXD6zsMfcomjn3t6I6x9SDnrYmTM20Qo%3D&reser > ved=0 > > None of us here at Microsoft have contributor status yet, so I'll need a > sponsor to get this change merged. > > Best, > Nikola > > -----Original Message----- > From: Alan Bateman <alan.bate...@oracle.com> > Sent: July 21, 2020 11:19 AM > To: Nikola Grcevski <nikola.grcev...@microsoft.com>; > net-dev@openjdk.java.net > Subject: Re: RFR(s): Improving performance of Windows socket connect > on the loopback adapter > > > > On 21/07/2020 02:34, Nikola Grcevski wrote: >> Hi Alan and Bernd, >> >> Thanks again for the code review of my changes and the suggestions! >> >> Please find the updated webrev here: >> >> https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.ope >> n >> jdk.java.net%2F~adityam%2Fnikola%2Ffast_connect_loopback_2%2F&dat >> a >> =02%7C01%7CNikola.Grcevski%40microsoft.com%7C4d89c178d8a147bc6e1708d8 >> 2 >> d895c25%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C6373094152629422 >> 8 >> 9&sdata=75i%2BHx1QXiqydrPd49Z4UbiO83SSLCxgXBrzovGDs%2FY%3D&re >> s >> erved=0 >> >> I decided to explicitly check so_rv for success consistently in the >> two places. It feels safer against future changes to the internal >> implementation of getsockopt. >> >> I left the JNICALL and jint to match the other similar functions in >> the net helper functions file as before. It sounds like future >> clean-up will simplify this, but if I misunderstood from your comments >> please let me know and I'll update accordingly. >> > I think this version looks okay, except that I'd prefer if the if the > expression at L244-246 were on one line, not split over there. Do you have a > sponsor to push this? > > -Alan >