-------------------------------------------------------------------------*\ * Select with timeout control \*-------------------------------------------------------------------------*/
| 105 | * Select with timeout control |
| 106 | \*-------------------------------------------------------------------------*/ |
| 107 | int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, |
| 108 | p_timeout tm) { |
| 109 | int ret; |
| 110 | do { |
| 111 | struct timeval tv; |
| 112 | double t = timeout_getretry(tm); |
| 113 | tv.tv_sec = (int) t; |
| 114 | tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6); |
| 115 | /* timeout = 0 means no wait */ |
| 116 | ret = select(n, rfds, wfds, efds, t >= 0.0 ? &tv: NULL); |
| 117 | } while (ret < 0 && errno == EINTR); |
| 118 | return ret; |
| 119 | } |
| 120 | |
| 121 | /*-------------------------------------------------------------------------*\ |
| 122 | * Creates and sets up a socket |
no test coverage detected