From f2e1a736377f59b2f7f12b0dcfc8c73e6e80e897 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 8 Jul 2011 10:58:56 +0000 Subject: [PATCH] apifix --- src/include/gnunet_os_lib.h | 9 ++------- src/nat/nat_mini.c | 23 +++++------------------ src/nat/test_nat_mini.c | 7 +------ src/util/os_priority.c | 15 +++------------ 4 files changed, 11 insertions(+), 43 deletions(-) diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index 36e7a563b..13e0b7a98 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h @@ -288,14 +288,9 @@ typedef void (*GNUNET_OS_LineProcessor)(void *cls, * Stop/kill a command. * * @param cmd handle to the process - * @param type status type - * @param code return code/signal number - * @return GNUNET_OK on success, GNUNET_NO if we killed the process */ -int -GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd, - enum GNUNET_OS_ProcessStatusType *type, - unsigned long *code); +void +GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd); /** diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c index 8f13d298f..2e4dd1a38 100644 --- a/src/nat/nat_mini.c +++ b/src/nat/nat_mini.c @@ -188,13 +188,10 @@ process_refresh_output (void *cls, const char *line) { struct GNUNET_NAT_MiniHandle *mini = cls; - enum GNUNET_OS_ProcessStatusType type; - unsigned long code; if (NULL == line) { - GNUNET_OS_command_stop (mini->refresh_cmd, - &type, &code); + GNUNET_OS_command_stop (mini->refresh_cmd); mini->refresh_cmd = NULL; mini->refresh_task = GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, &do_refresh, @@ -242,8 +239,6 @@ process_map_output (void *cls, const char *line) { struct GNUNET_NAT_MiniHandle *mini = cls; - enum GNUNET_OS_ProcessStatusType type; - unsigned long code; const char *ipaddr; char *ipa; const char *pstr; @@ -251,8 +246,7 @@ process_map_output (void *cls, if (NULL == line) { - GNUNET_OS_command_stop (mini->map_cmd, - &type, &code); + GNUNET_OS_command_stop (mini->map_cmd); mini->map_cmd = NULL; if (mini->did_map == GNUNET_YES) mini->refresh_task = GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, @@ -354,13 +348,10 @@ process_unmap_output (void *cls, const char *line) { struct GNUNET_NAT_MiniHandle *mini = cls; - enum GNUNET_OS_ProcessStatusType type; - unsigned long code; if (NULL == line) { - GNUNET_OS_command_stop (mini->unmap_cmd, - &type, &code); + GNUNET_OS_command_stop (mini->unmap_cmd); mini->unmap_cmd = NULL; GNUNET_free (mini); return; @@ -381,15 +372,12 @@ void GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini) { char pstr[6]; - enum GNUNET_OS_ProcessStatusType type; - unsigned long code; if (! mini->did_map) { if (mini->map_cmd != NULL) { - GNUNET_OS_command_stop (mini->map_cmd, - &type, &code); + GNUNET_OS_command_stop (mini->map_cmd); mini->map_cmd = NULL; } GNUNET_free (mini); @@ -402,8 +390,7 @@ GNUNET_NAT_mini_map_stop (struct GNUNET_NAT_MiniHandle *mini) } if (mini->refresh_cmd != NULL) { - GNUNET_OS_command_stop (mini->refresh_cmd, - &type, &code); + GNUNET_OS_command_stop (mini->refresh_cmd); mini->refresh_cmd = NULL; } mini->ac (mini->ac_cls, GNUNET_NO, diff --git a/src/nat/test_nat_mini.c b/src/nat/test_nat_mini.c index 57abca3d0..4e708c413 100644 --- a/src/nat/test_nat_mini.c +++ b/src/nat/test_nat_mini.c @@ -38,13 +38,8 @@ #define VERBOSE GNUNET_YES - /* Time to wait before stopping NAT, in seconds */ -#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) - - - - +#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) /** * Function called on each address that the NAT service diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 1cff5d140..5e641949d 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -1275,14 +1275,9 @@ struct GNUNET_OS_CommandHandle * from an independent task (not within the line processor). * * @param cmd handle to the process - * @param type status type - * @param code return code/signal number - * @return GNUNET_OK on success, GNUNET_NO if we killed the process */ -int -GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd, - enum GNUNET_OS_ProcessStatusType *type, - unsigned long *code) +void +GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd) { int killed; @@ -1293,14 +1288,10 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd, } killed = GNUNET_OS_process_kill (cmd->eip, SIGKILL); GNUNET_break (GNUNET_OK == - GNUNET_OS_process_status (cmd->eip, - type, code)); + GNUNET_OS_process_wait (cmd->eip)); GNUNET_OS_process_close (cmd->eip); GNUNET_DISK_pipe_close (cmd->opipe); GNUNET_free (cmd); - if (GNUNET_OK == killed) - return GNUNET_NO; - return GNUNET_OK; } -- 2.25.1