X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=http_recv.c;h=ac942b4f26e5012b3d92ecf655b6311ad2d9c489;hb=181beb316afad036ac01a778544c5dec0a8d51c7;hp=a5bbed634c2d6599fc8e7498d2f2bd7d32dd115a;hpb=9498eb1c15c7e92c50675e7a951c0c0ea73cd93d;p=paraslash.git diff --git a/http_recv.c b/http_recv.c index a5bbed63..ac942b4f 100644 --- a/http_recv.c +++ b/http_recv.c @@ -1,8 +1,4 @@ -/* - * Copyright (C) 2005 Andre Noll - * - * Licensed under the GPL v2. For licencing details see COPYING. - */ +/* Copyright (C) 2005 Andre Noll , see file COPYING. */ /** \file http_recv.c paraslash's http receiver */ @@ -30,7 +26,7 @@ /** * the possible states of a http receiver node * - * \sa receiver_node + * \sa \ref receiver_node. */ enum http_recv_status {HTTP_CONNECTED, HTTP_SENT_GET_REQUEST, HTTP_STREAMING}; @@ -46,7 +42,7 @@ struct private_http_recv_data { * It gets initialized to \p HTTP_CONNECTED by the open function of the * http receiver. * - * \sa receiver::open, receiver_node. + * \sa \ref receiver::open, \ref receiver_node. */ enum http_recv_status status; }; @@ -97,7 +93,7 @@ static int http_recv_post_select(struct sched *s, void *context) return 0; if (phd->status == HTTP_CONNECTED) { char *rq; - if (!FD_ISSET(rn->fd, &s->wfds)) + if (!sched_write_ok(rn->fd, s)) return 0; rq = make_request_msg(); PARA_INFO_LOG("sending http request\n"); @@ -109,9 +105,11 @@ static int http_recv_post_select(struct sched *s, void *context) return 0; } if (phd->status == HTTP_SENT_GET_REQUEST) { - ret = read_pattern(rn->fd, HTTP_OK_MSG, strlen(HTTP_OK_MSG), &s->rfds); - if (ret < 0) + ret = read_pattern(rn->fd, HTTP_OK_MSG, strlen(HTTP_OK_MSG)); + if (ret < 0) { + PARA_ERROR_LOG("did not receive HTTP OK message\n"); goto out; + } if (ret == 0) return 0; PARA_INFO_LOG("received ok msg, streaming\n"); @@ -122,7 +120,7 @@ static int http_recv_post_select(struct sched *s, void *context) iovcnt = btr_pool_get_buffers(rn->btrp, iov); if (iovcnt == 0) goto out; - ret = readv_nonblock(rn->fd, iov, iovcnt, &s->rfds, &num_bytes); + ret = readv_nonblock(rn->fd, iov, iovcnt, &num_bytes); if (num_bytes == 0) goto out; if (num_bytes <= iov[0].iov_len) /* only the first buffer was filled */ @@ -132,8 +130,10 @@ static int http_recv_post_select(struct sched *s, void *context) btr_add_output_pool(rn->btrp, num_bytes - iov[0].iov_len, btrn); } out: - if (ret < 0) + if (ret < 0) { + PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); btr_remove_node(&rn->btrn); + } return ret; } @@ -167,7 +167,6 @@ static int http_recv_open(struct receiver_node *rn) return 1; } -/** See \ref recv_init(). */ const struct receiver lsg_recv_cmd_com_http_user_data = { .open = http_recv_open, .close = http_recv_close,