gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23858 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r23858 - gnunet/src/util
Date: Mon, 17 Sep 2012 15:55:38 +0200

Author: grothoff
Date: 2012-09-17 15:55:38 +0200 (Mon, 17 Sep 2012)
New Revision: 23858

Modified:
   gnunet/src/util/crypto_rsa.c
   gnunet/src/util/os_priority.c
Log:
-use blocking wait as the pipe might be faster than the process cleanup

Modified: gnunet/src/util/crypto_rsa.c
===================================================================
--- gnunet/src/util/crypto_rsa.c        2012-09-17 13:45:03 UTC (rev 23857)
+++ gnunet/src/util/crypto_rsa.c        2012-09-17 13:55:38 UTC (rev 23858)
@@ -940,11 +940,7 @@
                                 const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CRYPTO_RsaKeyGenerationContext *gc = cls;
-  enum GNUNET_OS_ProcessStatusType type;
-  unsigned long code;
   struct GNUNET_CRYPTO_RsaPrivateKey *pk;
-  char buf[512];
-  ssize_t ret;
 
   gc->read_task = GNUNET_SCHEDULER_NO_TASK;
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
@@ -953,29 +949,8 @@
     GNUNET_CRYPTO_rsa_key_create_stop (gc);
     return;
   }
-  if (GNUNET_OK != 
-      GNUNET_OS_process_status (gc->gnunet_rsa,
-                               &type, &code))
-  {
-    if (0 >= (ret = GNUNET_DISK_file_read (GNUNET_DISK_pipe_handle 
(gc->gnunet_rsa_out,
-                                                                   
GNUNET_DISK_PIPE_END_READ),
-                                          buf, sizeof (buf))))
-      {
-       GNUNET_break (0);
-       gc->cont (gc->cont_cls, NULL, _("internal error"));
-       GNUNET_CRYPTO_rsa_key_create_stop (gc);
-       return;
-      }
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-               _("Unexpected gnunet-rsa output: %.*s\n"),
-               (int) ret, buf);
-    gc->read_task = GNUNET_SCHEDULER_add_read_file 
(GNUNET_TIME_UNIT_FOREVER_REL,
-                                                   GNUNET_DISK_pipe_handle 
(gc->gnunet_rsa_out,
-                                                                            
GNUNET_DISK_PIPE_END_READ),
-                                                   
&check_key_generation_completion,
-                                                   gc);    
-    return;
-  }
+  GNUNET_assert (GNUNET_OK == 
+                GNUNET_OS_process_wait (gc->gnunet_rsa));
   GNUNET_OS_process_destroy (gc->gnunet_rsa);
   gc->gnunet_rsa = NULL;
   if ( (GNUNET_OS_PROCESS_EXITED != type) ||

Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2012-09-17 13:45:03 UTC (rev 23857)
+++ gnunet/src/util/os_priority.c       2012-09-17 13:55:38 UTC (rev 23858)
@@ -1580,6 +1580,8 @@
 
   GNUNET_assert (0 != proc);
   ret = waitpid (proc->pid, &status, WNOHANG);
+  fprintf (stderr, "Waitpid %d returned %d\n",
+          proc->pid, ret);
   if (ret < 0)
   {
     LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "waitpid");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]