From 3f17a6b0fb4dc1687fb722d0e6033ed26c46c6fd Mon Sep 17 00:00:00 2001 From: Andre Date: Tue, 6 Jun 2006 03:01:59 +0200 Subject: [PATCH] dccp_send/http_send: add all fds to close_on_fork_list 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 | 7 +++++++ http_send.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dccp_send.c b/dccp_send.c index 9bfe65f6..cfff3093 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -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); } diff --git a/http_send.c b/http_send.c index 0e7d0241..5eebba56 100644 --- a/http_send.c +++ b/http_send.c @@ -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", -- 2.39.2