Code Review Request JDK-8146387, Test SSLSession/SessionCacheSizeTests socket accept timed out

Xuelei Fan xuelei.fan at oracle.com
Mon Jan 11 11:58:52 UTC 2016


On 1/11/2016 7:51 PM, Wang Weijun wrote:
> 
>> On Jan 11, 2016, at 7:02 PM, Xuelei Fan <xuelei.fan at oracle.com> wrote:
>>
>> On 1/11/2016 5:43 PM, Wang Weijun wrote:
>>>
>>>>>
>>>>>> You want to start a server on the same port on and on?
>>>>>>
>>>>> Not actually.  Different port are used for different server socket.  The
>>>>> logic looks like:
>>>>>  // define four slots for the ports
>>>>>  int serverPorts[] = new int[]{0, 0, 0, 0};
>>>>>
>>>>>  // for each slot, create a server socket,
>>>>>  // and assign the actually used port for each slot.
>>>>>  for each slots run a thread {
>>>>>     SSLServerSocket sslServerSocket = ...
>>>>>     serverPorts[nextPort] = sslServerSocket.getLocalPort();
>>>>>                 ^^^^^^^^
>>>>>  }
>>>>>
>>>>>  // use the actual port for each slot in client side
>>>>>  if (server ready) {
>>>>>     connect to the server socket (host:port)
>>>>>  }
>>>
>>> Why do you need a serverPort parameter in doServerSide()? Can it just always be 0?
>>>
>> It is always 0 before the server socket generated.  But after the server
>> socket generated,  need to remember the actual port so that client can
>> connect to the port.
> 
> Can you hard code zero?
> 
>   (SSLServerSocket) sslssf.createServerSocket(0)
> 
> Then those startServer() calls does not need to pass serverPorts[i] at all.
> 
Yes, I can.  There are also some other potential improvement for this
test case.  But I want to focus on the issue and don't want to touch
them at present.  Otherwise, if some other issue is introduced, it is
not easy to verify whether this update fixes this issue or not.

Thanks,
Xuelei

> --Max
> 
>>
>>>>>
>>>>> This fix is trying to increase the createdPorts value properly.  It is
>>>>> not actually need to synchronize serverPorts.
>>>
>>> I see. Why not just synchronized on this and add a small comment?
>>>
>> Synchronized on any object is OK.  I will add a comment like:
>>    // set the server port and increase the count synchronized
>>
>> Thanks,
>> Xuelei
> 




More information about the security-dev mailing list