X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=http_send.c;h=2c918fc8a53ef56c85dd7ae77b04a1ed63953f64;hp=6ededb275ac225d8a38d6ccbead967d53877fad4;hb=e1a07bd50c0e0bc393abf89a342ce53e10ccf576;hpb=9609fd30e0d3db45ede3ab5c6bc3a77c15b6aef8 diff --git a/http_send.c b/http_send.c index 6ededb27..2c918fc8 100644 --- a/http_send.c +++ b/http_send.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2009 Andre Noll + * Copyright (C) 2005-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -19,9 +19,9 @@ #include "afs.h" #include "server.h" #include "http.h" -#include "vss.h" #include "list.h" #include "send.h" +#include "vss.h" #include "close_on_fork.h" #include "net.h" #include "fd.h" @@ -96,23 +96,20 @@ static void http_post_select(fd_set *rfds, __a_unused fd_set *wfds) { struct sender_client *sc, *tmp; struct private_http_sender_data *phsd; + int ret; - if (hss->listen_fd < 0) - return; list_for_each_entry_safe(sc, tmp, &hss->client_list, node) { phsd = sc->private_data; switch (phsd->status) { case HTTP_STREAMING: /* nothing to do */ break; case HTTP_CONNECTED: /* need to recv get request */ - if (FD_ISSET(sc->fd, rfds)) { - if (recv_pattern(sc->fd, HTTP_GET_MSG, MAXLINE) - < 0) { - phsd->status = HTTP_INVALID_GET_REQUEST; - } else { - phsd->status = HTTP_GOT_GET_REQUEST; - PARA_INFO_LOG("received get request\n"); - } + ret = read_pattern(sc->fd, HTTP_GET_MSG, MAXLINE, rfds); + if (ret < 0) + phsd->status = HTTP_INVALID_GET_REQUEST; + else if (ret > 0) { + phsd->status = HTTP_GOT_GET_REQUEST; + PARA_INFO_LOG("received get request\n"); } break; case HTTP_GOT_GET_REQUEST: /* need to send ok msg */ @@ -125,9 +122,7 @@ static void http_post_select(fd_set *rfds, __a_unused fd_set *wfds) break; } } - if (!FD_ISSET(hss->listen_fd, rfds)) - return; - sc = accept_sender_client(hss); + sc = accept_sender_client(hss, rfds); if (!sc) return; phsd = para_malloc(sizeof(*phsd));