summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2001-10-25 15:48:03 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2001-10-25 15:48:03 +0000
commit9898c2e6653622da929bea54a718cd848bcaae05 (patch)
treea9e0e009f107b9a0e30befa5b167aa2a29d6370b
parent93660848f0ef2bda2b51d767323a6c415788ff75 (diff)
downloadxine-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.c37
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;
}