diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2007-04-27 00:35:54 +0000 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2007-04-27 00:35:54 +0000 |
commit | 8da4034f529f3c5dcc3f95a7d81032cc9be543fb (patch) | |
tree | dc3e28a55483f023bb7c13d27630f58830a4af02 /ffserver.c | |
parent | 0bdacf29d40b11cfd5dd0d13577a4bdc90afdcea (diff) | |
download | ffmpeg-8da4034f529f3c5dcc3f95a7d81032cc9be543fb.tar.gz |
use ff_neterrno() and FF_NETERROR() for networking error handling
Originally committed as revision 8845 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffserver.c')
-rw-r--r-- | ffserver.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ffserver.c b/ffserver.c index e7b0b7b314..9f5502b228 100644 --- a/ffserver.c +++ b/ffserver.c @@ -588,7 +588,8 @@ static int http_server(void) second to handle timeouts */ do { ret = poll(poll_table, poll_entry - poll_table, delay); - if (ret < 0 && errno != EAGAIN && errno != EINTR) + if (ret < 0 && ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) return -1; } while (ret < 0); @@ -791,7 +792,8 @@ static int handle_connection(HTTPContext *c) read_loop: len = recv(c->fd, c->buffer_ptr, 1, 0); if (len < 0) { - if (errno != EAGAIN && errno != EINTR) + if (ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) return -1; } else if (len == 0) { return -1; @@ -826,7 +828,8 @@ static int handle_connection(HTTPContext *c) return 0; len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (errno != EAGAIN && errno != EINTR) { + if (ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; @@ -896,7 +899,8 @@ static int handle_connection(HTTPContext *c) return 0; len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (errno != EAGAIN && errno != EINTR) { + if (ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) { /* error : close connection */ av_freep(&c->pb_buffer); return -1; @@ -922,7 +926,8 @@ static int handle_connection(HTTPContext *c) len = send(c->fd, c->packet_buffer_ptr, c->packet_buffer_end - c->packet_buffer_ptr, 0); if (len < 0) { - if (errno != EAGAIN && errno != EINTR) { + if (ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) { /* error : close connection */ av_freep(&c->packet_buffer); return -1; @@ -2333,7 +2338,8 @@ static int http_send_data(HTTPContext *c) /* TCP data output */ len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (errno != EAGAIN && errno != EINTR) { + if (ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) { /* error : close connection */ return -1; } else { @@ -2390,7 +2396,8 @@ static int http_receive_data(HTTPContext *c) len = recv(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0); if (len < 0) { - if (errno != EAGAIN && errno != EINTR) { + if (ff_neterrno() != FF_NETERROR(EAGAIN) && + ff_neterrno() != FF_NETERROR(EINTR)) { /* error : close connection */ goto fail; } |