]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
http_send: Send http OK message earlier.
authorAndre Noll <maan@systemlinux.org>
Sat, 19 Dec 2009 12:13:53 +0000 (13:13 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 19 Dec 2009 12:13:53 +0000 (13:13 +0100)
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.

http_send.c

index 5b98bbf4522c71d76a81d77e3de69f0545371ed0..0c48934aea55747fa9e24e9393b903d0b4754263 100644 (file)
@@ -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);
        }
 }