FUNCDEF("inner_select");
// setup the file descriptor sets for the select. we check readability,
// writability and exception status.
-LOG("select A");
FD_ZERO(&read_list); FD_SET(socket, &read_list);
-LOG("select B");
FD_ZERO(&write_list); FD_SET(socket, &write_list);
-LOG("select C");
FD_ZERO(&exceptions); FD_SET(socket, &exceptions);
-LOG("select D");
-timeval *farkle = new timeval;
-LOG("select D.1");
-time_stamp *t = new time_stamp();
-LOG("select D.2");
timeval time_out;
time_stamp::fill_timeval_ms(time_out, timeout);
// timeval has tv_sec=seconds, tv_usec=microseconds.
-LOG("select E");
// select will tell us about the socket.
int ret = ::select(socket + 1,
(mode & SELECTING_JUST_WRITE)? NIL : &read_list,
(mode & SELECTING_JUST_READ)? NIL : &write_list,
&exceptions, &time_out);
-LOG("select F");
int error = critical_events::system_error();
-LOG("select G");
-
if (!ret) return 0; // nothing to report.
if (ret == SOCKET_ERROR) {
-LOG("select H");
switch (error) {
// all real errors fall out to the error handling stuff.
case SOCK_EFAULT: // intentional fall-through.
#endif
return 0; // not really an error.
}
-LOG("select I");
#ifdef DEBUG_RAW_SOCKET
LOG(a_sprintf("socket %u had error %d in select: %s.",
socket, error, _stack->tcpip_error_name(error).s()));
return SI_ERRONEOUS;
}
-LOG("select J");
// if we got to here, then there are some things to report...
return SI_BASELINE;
}