static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = ff_network_wait_fd_timeout(s->fd, 0, h->rw_timeout, &h->interrupt_callback); if (ret) return ret; } ret = recv(s->fd, buf, size, 0); return ret < 0 ? ff_neterrno() : ret; }
static int tcp_write(URLContext *h, const uint8_t *buf, int size) { TCPContext *s = h->priv_data; int ret; if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = ff_network_wait_fd_timeout(s->fd, 1, h->rw_timeout, &h->interrupt_callback); if (ret) return ret; } ret = send(s->fd, buf, size, MSG_NOSIGNAL); return ret < 0 ? ff_neterrno() : ret; }
static int tcp_read(URLContext *h, uint8_t *buf, int size) { TCPContext *s = h->priv_data; int ret; // if(h->rw_timeout != 500*1000) /// av_log(NULL,AV_LOG_ERROR,"tcp_read:h->rw_timeout=%lld",h->rw_timeout); if (!(h->flags & AVIO_FLAG_NONBLOCK)) { ret = ff_network_wait_fd_timeout(s->fd, 0, h->rw_timeout, &h->interrupt_callback); if (ret) { if(ret == -110) av_log(NULL,AV_LOG_ERROR,"tcp:TIMEOUT:%lld",h->rw_timeout); // ff_send_message(&h->interrupt_callback,MEDIA_INFO_DOWNLOAD_ERROR,2000); return ret; } } ret = recv(s->fd, buf, size, 0); return ret < 0 ? ff_neterrno() : ret; }