Use sleep_ms instead of select in httpfetch when max_fd == -1, fixes WSAEINVAL

This commit is contained in:
Kahrl 2013-12-24 19:28:09 +01:00
parent a5377251e2
commit 3aa28bc7a2

@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "socket.h" // for select()
#include "porting.h" // for sleep_ms()
#include "httpfetch.h"
#include <iostream>
#include <sstream>
@ -520,6 +521,9 @@ protected:
select_timeout = timeout;
if (select_timeout > 0) {
// in Winsock it is forbidden to pass three empty
// fd_sets to select(), so in that case use sleep_ms
if (max_fd == -1) {
select_tv.tv_sec = select_timeout / 1000;
select_tv.tv_usec = (select_timeout % 1000) * 1000;
int retval = select(max_fd + 1, &read_fd_set,
@ -535,6 +539,10 @@ protected:
#endif
}
}
else {
sleep_ms(select_timeout);
}
}
}
void * Thread()