Browse Source

tcp: properly return EOF

There is no POSIX error code for EOF - recv() signals EOF by simply
returning 0. But libavformat recently changed its conventions and
requires an explicit AVERROR_EOF, or it might get into an endless retry
loop, consuming 100% CPU while doing nothing.
tags/n4.0
wm4 7 years ago
parent
commit
0e1f771d22
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavformat/tcp.c

+ 2
- 0
libavformat/tcp.c View File

@@ -225,6 +225,8 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
return ret;
}
ret = recv(s->fd, buf, size, 0);
if (ret == 0)
return AVERROR_EOF;
return ret < 0 ? ff_neterrno() : ret;
}



Loading…
Cancel
Save