Code Review: 6223635 Code hangs at connect call even when Timeout is specified when using a socks proxy
Michael McMahon
Michael.McMahon at Sun.COM
Thu Mar 11 09:34:54 PST 2010
Christopher Hegarty -Sun Microsystems Ireland wrote:
> Michael McMahon wrote:
>> Christopher Hegarty -Sun Microsystems Ireland wrote:
>>> Hi All,
>>>
>>> This patch fixes a problem where the socks proxy implementation does
>>> not honor the timeout specified in Socket.connect(SocketAddress,
>>> timeout). In fact, it uses the read timeout set with setSoTimeout
>>> since the socks implementation opens a connection to the socks
>>> server to perform the socks protocol. This also violates the spec
>>> since a timeout of 0 means block indefinitely.
>>>
>>> It is worth noting that the proposed fix changes the current
>>> behavior as specified above; SO_TIMEOUT no longer impacts on the
>>> timeout when using a socks proxy.
>>>
>> Do you mean there that SO_TIMEOUT does not affect the connect
>> behavior, but it still works
>> when reading off the socket after it is connected?
>
> Yes, this is correct. Since we need to read off the socket during the
> connection process to implement the socks protocol, the SO_TIMEOUT
> (before this fix) had an impact on the connection timeout. After this
> change SO_TIMEOUT will only impact on SocketInputStream reads,
> connection timeout can be implemented through the Socket.connect API.
>
Ok, just checking that. The fix looks fine to me then.
- Michael
More information about the net-dev
mailing list