diff options
author | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-10-25 15:48:03 +0000 |
---|---|---|
committer | Guenter Bartsch <guenter@users.sourceforge.net> | 2001-10-25 15:48:03 +0000 |
commit | 9898c2e6653622da929bea54a718cd848bcaae05 (patch) | |
tree | a9e0e009f107b9a0e30befa5b167aa2a29d6370b | |
parent | 93660848f0ef2bda2b51d767323a6c415788ff75 (diff) | |
download | xine-lib-9898c2e6653622da929bea54a718cd848bcaae05.tar.gz xine-lib-9898c2e6653622da929bea54a718cd848bcaae05.tar.bz2 |
...hope I'm getting closer to a correct socket read return value interpretation...
CVS patchset: 885
CVS date: 2001/10/25 15:48:03
-rw-r--r-- | src/input/input_http.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c index b6449b6ec..f755b4060 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -164,11 +164,16 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) { printf ("input_http: read...\n"); */ - switch (read (this->fh, &this->buf[len], 1)) { - case -1: - return 0; - case 0: - continue; + if (read (this->fh, &this->buf[len], 1) <=0) { + + switch (errno) { + case EAGAIN: + printf ("input_http: EAGAIN\n"); + continue; + default: + printf ("input_http: read error\n"); + return 0; + } } if (this->buf[len] == '\n') { @@ -197,15 +202,21 @@ static off_t http_plugin_read (input_plugin_t *this_gen, while (num_bytes < nlen) { - n = read (this->fh, buf, nlen); - - if (n<0) { - printf ("input_http: read error (%s)\n", strerror (errno)); - return num_bytes; - } else if (n > 0) { - num_bytes += n; - this->curpos += n; + n = read (this->fh, &buf[num_bytes], nlen - num_bytes); + + if (n <= 0) { + + switch (errno) { + case EAGAIN: + printf ("input_http: EAGAIN\n"); + continue; + default: + printf ("input_http: read error\n"); + return 0; + } } + + num_bytes += n; } return num_bytes; } |