| 154 | } |
| 155 | |
| 156 | static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout, |
| 157 | AVIOInterruptCB *cb) |
| 158 | { |
| 159 | int runs = timeout / POLLING_TIME; |
| 160 | int ret = 0; |
| 161 | |
| 162 | do { |
| 163 | if (ff_check_interrupt(cb)) |
| 164 | return AVERROR_EXIT; |
| 165 | ret = poll(p, nfds, POLLING_TIME); |
| 166 | if (ret != 0) { |
| 167 | if (ret < 0) |
| 168 | ret = ff_neterrno(); |
| 169 | if (ret == AVERROR(EINTR)) |
| 170 | continue; |
| 171 | break; |
| 172 | } |
| 173 | } while (timeout <= 0 || runs-- > 0); |
| 174 | |
| 175 | if (!ret) |
| 176 | return AVERROR(ETIMEDOUT); |
| 177 | return ret; |
| 178 | } |
| 179 | |
| 180 | int ff_socket(int af, int type, int proto, void *logctx) |
| 181 | { |
no test coverage detected