+ if (NULL == h->helper_proc)
+ return GNUNET_SYSERR;
+ if (GNUNET_YES == soft_kill)
+ {
+ /* soft-kill only possible with pipes */
+ GNUNET_assert (NULL != h->helper_in);
+ ret = GNUNET_DISK_pipe_close (h->helper_in);
+ h->helper_in = NULL;
+ h->fh_to_helper = NULL;
+ return ret;
+ }
+ if (0 != GNUNET_OS_process_kill (h->helper_proc, GNUNET_TERM_SIG))
+ return GNUNET_SYSERR;
+ return GNUNET_OK;
+}
+
+
+/**
+ * Reap the helper process. This call is blocking(!). The helper process
+ * should either be sent a termination signal before or should be dead before
+ * calling this function
+ *
+ * @param h the helper handle
+ * @return #GNUNET_OK on success; #GNUNET_SYSERR on error
+ */
+int
+GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h)
+{
+ struct GNUNET_HELPER_SendHandle *sh;
+ int ret;
+
+ ret = GNUNET_SYSERR;
+ if (NULL != h->helper_proc)
+ {
+ ret = GNUNET_OS_process_wait (h->helper_proc);
+ GNUNET_OS_process_destroy (h->helper_proc);
+ h->helper_proc = NULL;
+ }
+ if (NULL != h->read_task)
+ {
+ GNUNET_SCHEDULER_cancel (h->read_task);
+ h->read_task = NULL;
+ }
+ if (NULL != h->write_task)