]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
dccp_send/http_send: add all fds to close_on_fork_list
authorAndre <maan@ensslin.(none)>
Tue, 6 Jun 2006 01:01:59 +0000 (03:01 +0200)
committerAndre <maan@ensslin.(none)>
Tue, 6 Jun 2006 01:01:59 +0000 (03:01 +0200)
This caused para_audiod not to recognize the receiver eof because a
child of the server still had the peer fd open. Nasty.

dccp_send.c
http_send.c

index 9bfe65f68a7bc7634c5ba581589e95c96c434e18..cfff30933ca5a57fc7ecf6f3d5cb06a5a9481ef3 100644 (file)
@@ -31,6 +31,8 @@
 #include "dccp.h"
 #include "error.h"
 #include "string.h"
+#include "fd.h"
+#include "close_on_fork.h"
 #include "server.cmdline.h"
 extern struct gengetopt_args_info conf;
 /** the list of connected clients **/
@@ -75,6 +77,8 @@ static void dccp_post_select(fd_set *rfds, __a_unused fd_set *wfds)
        PARA_NOTICE_LOG("connection from %s\n", inet_ntoa(dc->addr.sin_addr));
        dc->fd = ret;
        list_add(&dc->node, &clients);
+       add_close_on_fork_list(dc->fd);
+       mark_fd_nonblock(dc->fd);
 }
 
 static int dccp_open(void)
@@ -101,6 +105,8 @@ static int dccp_open(void)
        if (ret < 0)
                return -E_DCCP_LISTEN;
        PARA_DEBUG_LOG("listening on fd %d\n", listen_fd);
+       add_close_on_fork_list(listen_fd);
+       mark_fd_nonblock(listen_fd);
        return 1;
 }
 
@@ -109,6 +115,7 @@ static void dccp_shutdown_client(struct dccp_client *dc)
        PARA_DEBUG_LOG("shutting down %s (fd %d)\n", inet_ntoa(dc->addr.sin_addr),
                dc->fd);
        close(dc->fd);
+       del_close_on_fork_list(dc->fd);
        list_del(&dc->node);
        free(dc);
 }
index 0e7d02415a8cdd70938544c3af66621b05ab630a..5eebba5612bd845190bc573fe3d73895e7c60c50 100644 (file)
@@ -116,7 +116,7 @@ static void http_shutdown_client(struct http_client *hc, const char *msg)
                hc->fd, msg);
        numclients--;
        close(hc->fd);
-
+       del_close_on_fork_list(hc->fd);
        list_for_each_entry_safe(qp, tmp, &hc->packet_queue, node) {
                free(qp->packet);
                list_del(&qp->node);
@@ -326,6 +326,8 @@ static void http_post_select(fd_set *rfds, fd_set *wfds)
                CLIENT_ADDR(hc), hc->fd);
        numclients++;
        list_add(&hc->node, &clients);
+       add_close_on_fork_list(hc->fd);
+       mark_fd_nonblock(hc->fd);
        return;
 err_out:
        PARA_WARNING_LOG("ignoring connect request from %s (%s)\n",