Commit 3054eb58 authored by benoit's avatar benoit

Get rid of MSG_DONTWAIT using a more standard way to use a socket

in a non blocked mode.
Patch by Jindrich Makovicka: makovick gmail


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15846 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7af0565a
...@@ -437,6 +437,8 @@ static int udp_open(URLContext *h, const char *uri, int flags) ...@@ -437,6 +437,8 @@ static int udp_open(URLContext *h, const char *uri, int flags)
if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) { if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno)); av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
} }
/* make the socket non-blocking */
ff_socket_nonblock(udp_fd, 1);
} }
s->udp_fd = udp_fd; s->udp_fd = udp_fd;
...@@ -468,7 +470,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) ...@@ -468,7 +470,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
return AVERROR(EIO); return AVERROR(EIO);
if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds))) if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
continue; continue;
len = recv(s->udp_fd, buf, size, MSG_DONTWAIT); len = recv(s->udp_fd, buf, size, 0);
if (len < 0) { if (len < 0) {
if (ff_neterrno() != FF_NETERROR(EAGAIN) && if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
ff_neterrno() != FF_NETERROR(EINTR)) ff_neterrno() != FF_NETERROR(EINTR))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment