From: Andre Noll Date: Sat, 19 Dec 2009 12:13:53 +0000 (+0100) Subject: http_send: Send http OK message earlier. X-Git-Tag: v0.4.1~5^2~16^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=4fa9ba989b0f95e7d49a725e07ff5b4a91015700 http_send: Send http OK message earlier. Without this change, the http OK message is sent just when the vss is about to start streaming, i.e. at the end of the announce interval. This might be too late and sometimes causes the client to not receive the first chunk(s). Fix this bug by adding the client file descriptor to the write fd set in http_preselect() in case we received the get request (or something else) so that the following call to select() will return immediately. The http OK message (or an error message) will then be sent much earlier. --- diff --git a/http_send.c b/http_send.c index 5b98bbf4..0c48934a 100644 --- a/http_send.c +++ b/http_send.c @@ -133,7 +133,7 @@ static void http_post_select(fd_set *rfds, __a_unused fd_set *wfds) phsd->status = HTTP_CONNECTED; } -static void http_pre_select(int *max_fileno, fd_set *rfds, __a_unused fd_set *wfds) +static void http_pre_select(int *max_fileno, fd_set *rfds, fd_set *wfds) { struct sender_client *sc, *tmp; @@ -144,6 +144,9 @@ static void http_pre_select(int *max_fileno, fd_set *rfds, __a_unused fd_set *wf struct private_http_sender_data *phsd = sc->private_data; if (phsd->status == HTTP_CONNECTED) /* need to recv get request */ para_fd_set(sc->fd, rfds, max_fileno); + if (phsd->status == HTTP_GOT_GET_REQUEST || + phsd->status == HTTP_INVALID_GET_REQUEST) + para_fd_set(sc->fd, wfds, max_fileno); } }