From: Christian Grothoff Date: Sun, 19 Feb 2017 12:57:34 +0000 (+0100) Subject: fix zombie-fest X-Git-Tag: taler-0.2.1~136 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=360d7afad50d1af425a20e89419d2063a6a0e220;p=oweals%2Fgnunet.git fix zombie-fest --- diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index ce3e05f13..b3800f286 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h @@ -381,7 +381,8 @@ GNUNET_OS_process_current (void); * @return 0 on success, -1 on error */ int -GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig); +GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, + int sig); /** diff --git a/src/nat/gnunet-service-nat_externalip.c b/src/nat/gnunet-service-nat_externalip.c index 979d2f0f5..8df6f48a5 100644 --- a/src/nat/gnunet-service-nat_externalip.c +++ b/src/nat/gnunet-service-nat_externalip.c @@ -23,15 +23,12 @@ * * This can be implemented using different methods, and we allow * the main service to be notified about changes to what we believe - * is our external IPv4 address. + * is our external IPv4 address. * * Note that this is explicitly only about NATed systems; if one * of our network interfaces has a global IP address this does * not count as "external". * - * TODO: - * - implement NEW logic for external IP detection based on traceroute! - * * @file nat/gnunet-service-nat_externalip.c * @brief Functions for monitoring external IPv4 addresses * @author Christian Grothoff @@ -86,7 +83,7 @@ struct GN_ExternalIPMonitor * Kept in DLL. */ struct GN_ExternalIPMonitor *prev; - + /** * Function to call when we believe our external IPv4 address changed. */ @@ -131,7 +128,7 @@ static struct in_addr mini_external_ipv4; /** * Tell relevant clients about a change in our external * IPv4 address. - * + * * @param add #GNUNET_YES to add, #GNUNET_NO to remove * @param v4 the external address that changed */ @@ -162,7 +159,7 @@ run_external_ip (void *cls); * We learn our current external IP address. If it changed, * notify all of our applicable clients. Also re-schedule * #run_external_ip with an appropriate timeout. - * + * * @param cls NULL * @param addr the address, NULL on errors * @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code @@ -173,7 +170,7 @@ handle_external_ip (void *cls, enum GNUNET_NAT_StatusCode result) { char buf[INET_ADDRSTRLEN]; - + probe_external_ip_op = NULL; GNUNET_SCHEDULER_cancel (probe_external_ip_task); probe_external_ip_task @@ -204,7 +201,7 @@ handle_external_ip (void *cls, if (0 != mini_external_ipv4.s_addr) notify_monitors_external_ipv4_change (GNUNET_NO, &mini_external_ipv4); - mini_external_ipv4.s_addr = 0; + mini_external_ipv4.s_addr = 0; break; } } @@ -254,7 +251,7 @@ GN_nat_status_changed (int have_nat) NULL); return; } - if (GNUNET_NO == have_nat) + if (GNUNET_NO == have_nat) { if (NULL != probe_external_ip_task) { diff --git a/src/nat/gnunet-service-nat_mini.c b/src/nat/gnunet-service-nat_mini.c index e5b9d021b..8f1229be1 100644 --- a/src/nat/gnunet-service-nat_mini.c +++ b/src/nat/gnunet-service-nat_mini.c @@ -123,7 +123,7 @@ read_external_ipv4 (void *cls) { /* try to read more */ eh->off += ret; - eh->task + eh->task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, eh->r, &read_external_ipv4, @@ -233,7 +233,7 @@ GNUNET_NAT_mini_get_external_ipv4_ (GNUNET_NAT_IPCallback cb, GNUNET_DISK_PIPE_END_WRITE); eh->r = GNUNET_DISK_pipe_handle (eh->opipe, GNUNET_DISK_PIPE_END_READ); - eh->task + eh->task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, eh->r, &read_external_ipv4, @@ -254,6 +254,8 @@ GNUNET_NAT_mini_get_external_ipv4_cancel_ (struct GNUNET_NAT_ExternalHandle *eh) { (void) GNUNET_OS_process_kill (eh->eip, SIGKILL); + GNUNET_break (GNUNET_OK == + GNUNET_OS_process_wait (eh->eip)); GNUNET_OS_process_destroy (eh->eip); } if (NULL != eh->opipe) @@ -372,7 +374,7 @@ run_upnpc_r (struct GNUNET_NAT_MiniHandle *mini) sizeof (pstr), "%u", (unsigned int) mini->port); - mini->map_cmd + mini->map_cmd = GNUNET_OS_command_run (&process_map_output, mini, MAP_TIMEOUT, @@ -516,7 +518,7 @@ do_refresh (void *cls) struct GNUNET_NAT_MiniHandle *mini = cls; int ac; - mini->refresh_task + mini->refresh_task = GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, &do_refresh, mini); @@ -538,7 +540,7 @@ do_refresh (void *cls) mini->refresh_cmd = NULL; ac = GNUNET_YES; } - mini->refresh_cmd + mini->refresh_cmd = GNUNET_OS_command_run (&process_refresh_output, mini, MAP_TIMEOUT, @@ -582,7 +584,7 @@ process_map_output (void *cls, 0, GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED); if (NULL == mini->refresh_task) - mini->refresh_task + mini->refresh_task = GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, &do_refresh, mini); @@ -747,7 +749,7 @@ GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini) LOG (GNUNET_ERROR_TYPE_DEBUG, "Unmapping port %u with UPnP\n", ntohs (mini->current_addr.sin_port)); - mini->unmap_cmd + mini->unmap_cmd = GNUNET_OS_command_run (&process_unmap_output, mini, UNMAP_TIMEOUT,