diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-03 21:29:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-03 21:29:22 +0000 |
commit | 2b8b0b0dac4286b5f935167b57db5255eab1681f (patch) | |
tree | 0d5b808d7e09d9046b5cf842cd0b97a6e50f5f6d /src/util | |
parent | 1ce43f352bed1f5d95db4f09773b7ecb574c41de (diff) | |
download | gnunet-2b8b0b0dac4286b5f935167b57db5255eab1681f.tar.gz gnunet-2b8b0b0dac4286b5f935167b57db5255eab1681f.zip |
-fix
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/helper.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/util/helper.c b/src/util/helper.c index c47b201c5..e5c3be08f 100644 --- a/src/util/helper.c +++ b/src/util/helper.c | |||
@@ -218,7 +218,7 @@ static void | |||
218 | helper_read (void *cls, | 218 | helper_read (void *cls, |
219 | const struct GNUNET_SCHEDULER_TaskContext *tsdkctx) | 219 | const struct GNUNET_SCHEDULER_TaskContext *tsdkctx) |
220 | { | 220 | { |
221 | struct GNUNET_HELPER_Handle*h = cls; | 221 | struct GNUNET_HELPER_Handle *h = cls; |
222 | char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; | 222 | char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE]; |
223 | ssize_t t; | 223 | ssize_t t; |
224 | 224 | ||
@@ -231,7 +231,7 @@ helper_read (void *cls, | |||
231 | return; | 231 | return; |
232 | } | 232 | } |
233 | t = GNUNET_DISK_file_read (h->fh_from_helper, &buf, sizeof (buf)); | 233 | t = GNUNET_DISK_file_read (h->fh_from_helper, &buf, sizeof (buf)); |
234 | if (t <= 0) | 234 | if (t < 0) |
235 | { | 235 | { |
236 | /* On read-error, restart the helper */ | 236 | /* On read-error, restart the helper */ |
237 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 237 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -245,6 +245,20 @@ helper_read (void *cls, | |||
245 | &restart_task, h); | 245 | &restart_task, h); |
246 | return; | 246 | return; |
247 | } | 247 | } |
248 | if (0 == t) | ||
249 | { | ||
250 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
251 | _("Got 0 bytes from helper `%s' (EOF)\n"), | ||
252 | h->binary_name); | ||
253 | #if 0 | ||
254 | stop_helper (h); | ||
255 | /* Restart the helper */ | ||
256 | h->restart_task = | ||
257 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
258 | &restart_task, h); | ||
259 | #endif | ||
260 | return; | ||
261 | } | ||
248 | if (GNUNET_SYSERR == | 262 | if (GNUNET_SYSERR == |
249 | GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO)) | 263 | GNUNET_SERVER_mst_receive (h->mst, NULL, buf, t, GNUNET_NO, GNUNET_NO)) |
250 | { | 264 | { |
@@ -285,10 +299,8 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
285 | } | 299 | } |
286 | h->fh_from_helper = | 300 | h->fh_from_helper = |
287 | GNUNET_DISK_pipe_handle (h->helper_out, GNUNET_DISK_PIPE_END_READ); | 301 | GNUNET_DISK_pipe_handle (h->helper_out, GNUNET_DISK_PIPE_END_READ); |
288 | GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE); | ||
289 | h->fh_to_helper = | 302 | h->fh_to_helper = |
290 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); | 303 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); |
291 | GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ); | ||
292 | h->helper_proc = | 304 | h->helper_proc = |
293 | GNUNET_OS_start_process_vap (h->helper_in, h->helper_out, | 305 | GNUNET_OS_start_process_vap (h->helper_in, h->helper_out, |
294 | h->binary_name, | 306 | h->binary_name, |
@@ -302,6 +314,8 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
302 | &restart_task, h); | 314 | &restart_task, h); |
303 | return; | 315 | return; |
304 | } | 316 | } |
317 | GNUNET_DISK_pipe_close_end (h->helper_out, GNUNET_DISK_PIPE_END_WRITE); | ||
318 | GNUNET_DISK_pipe_close_end (h->helper_in, GNUNET_DISK_PIPE_END_READ); | ||
305 | h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | 319 | h->read_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
306 | h->fh_from_helper, | 320 | h->fh_from_helper, |
307 | &helper_read, | 321 | &helper_read, |