if (NULL != h->helper_proc)
{
- GNUNET_OS_process_kill (h->helper_proc, SIGTERM);
- GNUNET_OS_process_wait (h->helper_proc);
+ GNUNET_break (0 == GNUNET_OS_process_kill (h->helper_proc, SIGTERM));
+ GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (h->helper_proc));
GNUNET_OS_process_close (h->helper_proc);
h->helper_proc = NULL;
}
GNUNET_CONTAINER_DLL_remove (h->mq_head,
h->mq_tail,
qe);
- qe->cont (qe->cont_cls, GNUNET_NO);
+ if (NULL != qe->cont)
+ qe->cont (qe->cont_cls, GNUNET_NO);
GNUNET_free (qe);
}
/* purge MST buffer */
- GNUNET_SERVER_mst_receive (h->mst, NULL, NULL, 0, GNUNET_YES, GNUNET_NO);
+ (void) GNUNET_SERVER_mst_receive (h->mst, NULL, NULL, 0, GNUNET_YES, GNUNET_NO);
}
*/
static void
helper_read (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tsdkctx)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_HELPER_Handle *h = cls;
char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE];
ssize_t t;
h->read_task = GNUNET_SCHEDULER_NO_TASK;
- if (0 != (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* try again */
h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
&restart_task, h);
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Got %u bytes from helper `%s'\n"),
+ (unsigned int) t,
+ h->binary_name);
+ h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
+ h->fh_from_helper, &helper_read, h);
if (GNUNET_SYSERR ==
GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO))
{
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&restart_task, h);
return;
-
}
- h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- h->fh_from_helper, &helper_read, h);
}
static void
start_helper (struct GNUNET_HELPER_Handle *h)
{
- h->helper_in = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO);
- h->helper_out = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_NO, GNUNET_YES);
+ h->helper_in = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO);
+ h->helper_out = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES);
if ( (h->helper_in == NULL) || (h->helper_out == NULL))
{
/* out of file descriptors? try again later... */
GNUNET_CONTAINER_DLL_remove (h->mq_head,
h->mq_tail,
qe);
- qe->cont (qe->cont_cls, GNUNET_SYSERR);
+ if (NULL != qe->cont)
+ qe->cont (qe->cont_cls, GNUNET_SYSERR);
GNUNET_free (qe);
}
stop_helper (h);
*/
static void
helper_write (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tsdkctx)
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct GNUNET_HELPER_Handle *h = cls;
struct HelperMessageQueueEntry *qe;
ssize_t t;
h->write_task = GNUNET_SCHEDULER_NO_TASK;
- if (0 != (tsdkctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
{
/* try again */
h->write_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
struct HelperMessageQueueEntry *qe;
uint16_t mlen;
+ if (NULL == h->fh_to_helper)
+ return GNUNET_NO;
if ( (GNUNET_YES == can_drop) &&
(h->mq_head != NULL) )
return GNUNET_NO;