apifix
authorChristian Grothoff <christian@grothoff.org>
Fri, 8 Jul 2011 10:58:56 +0000 (10:58 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 8 Jul 2011 10:58:56 +0000 (10:58 +0000)
src/include/gnunet_os_lib.h
src/nat/nat_mini.c
src/nat/test_nat_mini.c
src/util/os_priority.c

index 36e7a563b594cab903ae5e92de4bdf5cffe8eb14..13e0b7a98b04545f450f6692561214238685a9d3 100644 (file)
@@ -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);
 
 
 /**
index 8f13d298fa8846178f33e15fec3326b71ae7047f..2e4dd1a38301f940a62b3e0bb0ad2be75b472e5a 100644 (file)
@@ -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,
index 57abca3d0ca94cec90edc898241eb33b2248695e..4e708c41323f3ecae69722be5a790fd42ddf2c43 100644 (file)
 
 #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
index 1cff5d1401470bea4a817fb9d5cdab07ecdfbf52..5e641949d263b2a50cf839a8a35e95eefdc11ad5 100644 (file)
@@ -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;  
 }