X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=udp_send.c;h=04e2982f86bf125c5b4ce8ab2d6daa9280ea0bce;hp=eea1c93355c1461ada446942ef4d2d91f71cef46;hb=3b0a8fdb191309652e71e104a8f3705d55a93d3e;hpb=0b786d977ded3c3922e851e5b8d60837b43469b9 diff --git a/udp_send.c b/udp_send.c index eea1c933..04e2982f 100644 --- a/udp_send.c +++ b/udp_send.c @@ -18,13 +18,13 @@ #include "error.h" #include "string.h" #include "afh.h" +#include "net.h" #include "server.h" #include "list.h" #include "send.h" #include "sched.h" #include "vss.h" #include "portable_io.h" -#include "net.h" #include "fd.h" #include "close_on_fork.h" @@ -72,8 +72,11 @@ static void udp_delete_target(struct sender_client *sc, const char *msg) PARA_NOTICE_LOG("deleting %s (%s) from list\n", sc->name, msg); udp_close_target(sc); - close(sc->fd); - del_close_on_fork_list(sc->fd); + /* command handlers already called close_listed_fds() */ + if (!process_is_command_handler()) { + close(sc->fd); + del_close_on_fork_list(sc->fd); + } vss_del_fec_client(ut->fc); list_del(&sc->node); free(sc->name); @@ -164,6 +167,13 @@ static void udp_shutdown_targets(void) udp_close_target(sc); } +static void udp_shutdown(void) +{ + struct sender_client *sc, *tmp; + list_for_each_entry_safe(sc, tmp, &targets, node) + udp_delete_target(sc, "shutdown"); +} + static int udp_resolve_target(const char *url, struct sender_command_data *scd) { const char *result; @@ -435,6 +445,7 @@ static void udp_send_init(void) const struct sender udp_sender = { .name = "udp", .init = udp_send_init, + .shutdown = udp_shutdown, .shutdown_clients = udp_shutdown_targets, .resolve_target = udp_resolve_target, .client_cmds = {