Our Read functions were taking a timeout of UINT32_MAX to mean wait forever, but then

we didn't implement that in setting the socket option.
<rdar://problem/10711649>

llvm-svn: 148616
This commit is contained in:
Jim Ingham 2012-01-21 02:03:41 +00:00
parent 5928f64e2c
commit c668f81107
1 changed files with 10 additions and 2 deletions

View File

@ -983,8 +983,16 @@ ConnectionFileDescriptor::SetSocketReceiveTimeout (uint32_t timeout_usec)
//printf ("ConnectionFileDescriptor::SetSocketReceiveTimeout (timeout_usec = %u)\n", timeout_usec);
struct timeval timeout;
timeout.tv_sec = timeout_usec / TimeValue::MicroSecPerSec;
timeout.tv_usec = timeout_usec % TimeValue::MicroSecPerSec;
if (timeout_usec == UINT32_MAX)
{
timeout.tv_sec = 0;
timeout.tv_usec = 0;
}
else
{
timeout.tv_sec = timeout_usec / TimeValue::MicroSecPerSec;
timeout.tv_usec = timeout_usec % TimeValue::MicroSecPerSec;
}
if (::setsockopt (m_fd_recv, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) == 0)
{
m_socket_timeout_usec = timeout_usec;