From 9315fa7ca773e561efaba508f1868c9412bb9884 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Tue, 20 Jul 2010 19:53:52 +0000 Subject: [PATCH] restart the helper when something goes wrong --- src/vpn/gnunet-daemon-vpn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index e3ae2a16e..b003d7b53 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c @@ -92,8 +92,9 @@ static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* ts while (r < sizeof(struct suid_packet_header)) { int t = GNUNET_DISK_file_read(mycls->fh_from_helper, &hdr, sizeof(struct suid_packet_header)); - if (t< 0) { + if (t<=0) { fprintf(stderr, "Read error for header: %m\n"); + GNUNET_SCHEDULER_add_now(mycls->sched, restart_helper, cls); return; } r += t; @@ -108,8 +109,9 @@ static void helper_read(void* cls, const struct GNUNET_SCHEDULER_TaskContext* ts while (r < ntohl(pkt->hdr.size)) { int t = GNUNET_DISK_file_read(mycls->fh_from_helper, (unsigned char*)pkt + r, ntohl(pkt->hdr.size) - r); - if (t< 0) { + if (t<=0) { fprintf(stderr, "Read error for data: %m\n"); + GNUNET_SCHEDULER_add_now(mycls->sched, restart_helper, cls); return; } r += t; -- 2.25.1