select() may update timeval.

This commit is contained in:
Bartosz Taudul 2017-09-15 22:44:50 +02:00
parent f29669152e
commit 0a7d413e83

View File

@ -119,7 +119,12 @@ int Socket::Recv( void* _buf, int len, const timeval* tv )
FD_ZERO( &fds ); FD_ZERO( &fds );
FD_SET( m_sock, &fds ); FD_SET( m_sock, &fds );
#ifndef _WIN32
timeval _tv = *tv;
select( m_sock+1, &fds, nullptr, nullptr, &_tv );
#else
select( m_sock+1, &fds, nullptr, nullptr, tv ); select( m_sock+1, &fds, nullptr, nullptr, tv );
#endif
if( FD_ISSET( m_sock, &fds ) ) if( FD_ISSET( m_sock, &fds ) )
{ {
return recv( m_sock, buf, len, 0 ); return recv( m_sock, buf, len, 0 );