-------------------------------------------------------------------------*\ * Accept with timeout \*-------------------------------------------------------------------------*/
| 177 | * Accept with timeout |
| 178 | \*-------------------------------------------------------------------------*/ |
| 179 | int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, |
| 180 | p_timeout tm) { |
| 181 | if (*ps == SOCKET_INVALID) return IO_CLOSED; |
| 182 | for ( ;; ) { |
| 183 | int err; |
| 184 | /* try to get client socket */ |
| 185 | if ((*pa = accept(*ps, addr, len)) != SOCKET_INVALID) return IO_DONE; |
| 186 | /* find out why we failed */ |
| 187 | err = WSAGetLastError(); |
| 188 | /* if we failed because there was no connectoin, keep trying */ |
| 189 | if (err != WSAEWOULDBLOCK && err != WSAECONNABORTED) return err; |
| 190 | /* call select to avoid busy wait */ |
| 191 | if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | /*-------------------------------------------------------------------------*\ |
| 196 | * Send with timeout |
nothing calls this directly
no test coverage detected