diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-08-29 13:09:25 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-08-29 13:09:25 +0000 |
commit | a4b74ef335873379d374d372bcce7c4228095bd5 (patch) | |
tree | 7948e9ea9d8f3fc9d2d767fd2490c8a1855d1129 /src/util/helper.c | |
parent | 19a28dc192c59da09b2668c33fbbcce421f5a05d (diff) | |
download | gnunet-a4b74ef335873379d374d372bcce7c4228095bd5.tar.gz gnunet-a4b74ef335873379d374d372bcce7c4228095bd5.zip |
only use control pipe with helpers IF the helper actually supports it
Diffstat (limited to 'src/util/helper.c')
-rw-r--r-- | src/util/helper.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/util/helper.c b/src/util/helper.c index 64b014994..9faf2ee50 100644 --- a/src/util/helper.c +++ b/src/util/helper.c | |||
@@ -152,6 +152,12 @@ struct GNUNET_HELPER_Handle | |||
152 | * Restart task. | 152 | * Restart task. |
153 | */ | 153 | */ |
154 | GNUNET_SCHEDULER_TaskIdentifier restart_task; | 154 | GNUNET_SCHEDULER_TaskIdentifier restart_task; |
155 | |||
156 | /** | ||
157 | * Does the helper support the use of a control pipe for signalling? | ||
158 | */ | ||
159 | int with_control_pipe; | ||
160 | |||
155 | }; | 161 | }; |
156 | 162 | ||
157 | 163 | ||
@@ -341,10 +347,10 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
341 | h->fh_to_helper = | 347 | h->fh_to_helper = |
342 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); | 348 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); |
343 | h->helper_proc = | 349 | h->helper_proc = |
344 | GNUNET_OS_start_process_vap (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, | 350 | GNUNET_OS_start_process_vap (h->with_control_pipe, GNUNET_OS_INHERIT_STD_ERR, |
345 | h->helper_in, h->helper_out, | 351 | h->helper_in, h->helper_out, |
346 | h->binary_name, | 352 | h->binary_name, |
347 | h->binary_argv); | 353 | h->binary_argv); |
348 | if (NULL == h->helper_proc) | 354 | if (NULL == h->helper_proc) |
349 | { | 355 | { |
350 | /* failed to start process? try again later... */ | 356 | /* failed to start process? try again later... */ |
@@ -385,6 +391,7 @@ restart_task (void *cls, | |||
385 | * restarted when it dies except when it is stopped using GNUNET_HELPER_stop() | 391 | * restarted when it dies except when it is stopped using GNUNET_HELPER_stop() |
386 | * or when the exp_cb callback is not NULL. | 392 | * or when the exp_cb callback is not NULL. |
387 | * | 393 | * |
394 | * @param with_control_pipe does the helper support the use of a control pipe for signalling? | ||
388 | * @param binary_name name of the binary to run | 395 | * @param binary_name name of the binary to run |
389 | * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this | 396 | * @param binary_argv NULL-terminated list of arguments to give when starting the binary (this |
390 | * argument must not be modified by the client for | 397 | * argument must not be modified by the client for |
@@ -396,7 +403,8 @@ restart_task (void *cls, | |||
396 | * @return the new Handle, NULL on error | 403 | * @return the new Handle, NULL on error |
397 | */ | 404 | */ |
398 | struct GNUNET_HELPER_Handle * | 405 | struct GNUNET_HELPER_Handle * |
399 | GNUNET_HELPER_start (const char *binary_name, | 406 | GNUNET_HELPER_start (int with_control_pipe, |
407 | const char *binary_name, | ||
400 | char *const binary_argv[], | 408 | char *const binary_argv[], |
401 | GNUNET_SERVER_MessageTokenizerCallback cb, | 409 | GNUNET_SERVER_MessageTokenizerCallback cb, |
402 | GNUNET_HELPER_ExceptionCallback exp_cb, | 410 | GNUNET_HELPER_ExceptionCallback exp_cb, |
@@ -405,6 +413,7 @@ GNUNET_HELPER_start (const char *binary_name, | |||
405 | struct GNUNET_HELPER_Handle*h; | 413 | struct GNUNET_HELPER_Handle*h; |
406 | 414 | ||
407 | h = GNUNET_malloc (sizeof (struct GNUNET_HELPER_Handle)); | 415 | h = GNUNET_malloc (sizeof (struct GNUNET_HELPER_Handle)); |
416 | h->with_control_pipe = with_control_pipe; | ||
408 | h->binary_name = binary_name; | 417 | h->binary_name = binary_name; |
409 | h->binary_argv = binary_argv; | 418 | h->binary_argv = binary_argv; |
410 | h->cb_cls = cb_cls; | 419 | h->cb_cls = cb_cls; |