int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb)

{

    int ret;

    int64_t wait_start = 0;



    while (1) {

        ret = ff_network_wait_fd(fd, write);

        if (ret != AVERROR(EAGAIN))

            return ret;

        if (ff_check_interrupt(int_cb))

            return AVERROR_EXIT;

        if (timeout > 0) {

            if (!wait_start)

                wait_start = av_gettime();

            else if (av_gettime() - wait_start > timeout)

                return AVERROR(ETIMEDOUT);

        }

    }

}

int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb)

{

    int ret;

    int64_t wait_start = 0;



    while (1) {

        ret = ff_network_wait_fd(fd, write);

        if (ret != AVERROR(EAGAIN))

            return ret;

        if (ff_check_interrupt(int_cb))

            return AVERROR_EXIT;

        if (timeout > 0) {

            if (!wait_start)

                wait_start = av_gettime();

            else if (av_gettime() - wait_start > timeout)

                return AVERROR(ETIMEDOUT);

        }

    }

}

int FUNC_0(int VAR_0, int VAR_1, int64_t VAR_2, AVIOInterruptCB *VAR_3)

{

    int VAR_4;

    int64_t wait_start = 0;



    while (1) {

        VAR_4 = ff_network_wait_fd(VAR_0, VAR_1);

        if (VAR_4 != AVERROR(EAGAIN))

            return VAR_4;

        if (ff_check_interrupt(VAR_3))

            return AVERROR_EXIT;

        if (VAR_2 > 0) {

            if (!wait_start)

                wait_start = av_gettime();

            else if (av_gettime() - wait_start > VAR_2)

                return AVERROR(ETIMEDOUT);

        }

    }

}

int FUNC_0(int VAR_0, int VAR_1, int64_t VAR_2, AVIOInterruptCB *VAR_3)
{ int VAR_4; int64_t wait_start = 0; while (1) { VAR_4 = ff_network_wait_fd(VAR_0, VAR_1); if (VAR_4 != AVERROR(EAGAIN))
return VAR_4; if (ff_check_interrupt(VAR_3))
return AVERROR_EXIT; if (VAR_2 > 0) { if (!wait_start)
wait_start = av_gettime(); else if (av_gettime() - wait_start > VAR_2)
return AVERROR(ETIMEDOUT); } } }