| 73 | } |
| 74 | |
| 75 | int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb) |
| 76 | { |
| 77 | int ret; |
| 78 | int64_t wait_start = 0; |
| 79 | |
| 80 | while (1) { |
| 81 | if (ff_check_interrupt(int_cb)) |
| 82 | return AVERROR_EXIT; |
| 83 | ret = ff_network_wait_fd(fd, write); |
| 84 | if (ret != AVERROR(EAGAIN)) |
| 85 | return ret; |
| 86 | if (timeout > 0) { |
| 87 | if (!wait_start) |
| 88 | wait_start = av_gettime_relative(); |
| 89 | else if (av_gettime_relative() - wait_start > timeout) |
| 90 | return AVERROR(ETIMEDOUT); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | int ff_network_sleep_interruptible(int64_t timeout, AVIOInterruptCB *int_cb) |
| 96 | { |
no test coverage detected