Jacob Craig Lewallen wrote:
I mentioned this a few months ago and she seems to have fallen through the cracks... or I'm mistaken and nobody told me... I'm using the apr_socket_timeout_set call to set a timeout on a socket and then using the same call to turn the timeout off again after I've established a connection. There seems to be a small problem with the flag management in this process.

Basically, APR, as expected, makes the socket non blocking to handle the timeouts. When I turn off the timeouts

I assume that your app did

  apr_socket_timeout_set(sock, 0)

to clear the timeout?

That is expected to leave your socket non-blocking.

To really turn off the timeouts, you need to do

  apr_socket_timeout_set(sock, -1)

I just hacked up apr/test/client.c to try your testcase. With timeout parameter of 0, I see what you see. With timeout parameter of -1, it works as expected.

I'll update the doc for apr_socket_timeout_set() to clarify that

timeout > 0: read and write calls return APR_TIMEUP if specified time elapsess without making progress on the read or write request

timeout == 0: read and write calls never block

timeout < 0: read and write calls block




Reply via email to