diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-11-03 21:26:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-11-03 21:26:40 +0000 |
commit | 721e49caeea6ba5073f8bc5c6c08359295c02bb5 (patch) | |
tree | e06e80ba90af91e9452a48a7a5782913199b4877 /src/vpn/gnunet-daemon-vpn.c | |
parent | 37ac1b7c9e9e05f93d4100cfb53450ec2d370989 (diff) | |
download | gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.tar.gz gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.zip |
original patch from Mantis 1614
Diffstat (limited to 'src/vpn/gnunet-daemon-vpn.c')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index f231ed782..a6f78d707 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -94,7 +94,7 @@ static unsigned char restart_hijack; | |||
94 | /** | 94 | /** |
95 | * The process id of the helper | 95 | * The process id of the helper |
96 | */ | 96 | */ |
97 | static pid_t helper_pid; | 97 | static GNUNET_OS_Process *helper_proc; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * a list of outgoing dns-query-packets | 100 | * a list of outgoing dns-query-packets |
@@ -177,8 +177,10 @@ cleanup(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { | |||
177 | GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); | 177 | GNUNET_assert (0 != (tskctx->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)); |
178 | 178 | ||
179 | /* stop the helper */ | 179 | /* stop the helper */ |
180 | PLIBC_KILL(helper_pid, SIGTERM); | 180 | GNUNET_OS_process_kill (helper_proc, SIGTERM); |
181 | GNUNET_OS_process_wait(helper_pid); | 181 | GNUNET_OS_process_wait (helper_proc); |
182 | GNUNET_OS_process_close (helper_proc); | ||
183 | helper_proc = NULL; | ||
182 | 184 | ||
183 | /* close the connection to the service-dns */ | 185 | /* close the connection to the service-dns */ |
184 | if (dns_connection != NULL) | 186 | if (dns_connection != NULL) |
@@ -202,7 +204,7 @@ start_helper_and_schedule(void *cls, | |||
202 | 204 | ||
203 | if (helper_in == NULL || helper_out == NULL) return; | 205 | if (helper_in == NULL || helper_out == NULL) return; |
204 | 206 | ||
205 | helper_pid = GNUNET_OS_start_process(helper_in, helper_out, "gnunet-helper-vpn", "gnunet-helper-vpn", NULL); | 207 | helper_proc = GNUNET_OS_start_process(helper_in, helper_out, "gnunet-helper-vpn", "gnunet-helper-vpn", NULL); |
206 | 208 | ||
207 | fh_from_helper = GNUNET_DISK_pipe_handle (helper_out, GNUNET_DISK_PIPE_END_READ); | 209 | fh_from_helper = GNUNET_DISK_pipe_handle (helper_out, GNUNET_DISK_PIPE_END_READ); |
208 | fh_to_helper = GNUNET_DISK_pipe_handle (helper_in, GNUNET_DISK_PIPE_END_WRITE); | 210 | fh_to_helper = GNUNET_DISK_pipe_handle (helper_in, GNUNET_DISK_PIPE_END_WRITE); |
@@ -219,8 +221,10 @@ start_helper_and_schedule(void *cls, | |||
219 | static void | 221 | static void |
220 | restart_helper(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { | 222 | restart_helper(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) { |
221 | // Kill the helper | 223 | // Kill the helper |
222 | PLIBC_KILL(helper_pid, SIGKILL); | 224 | GNUNET_OS_process_kill (helper_proc, SIGKILL); |
223 | GNUNET_OS_process_wait(helper_pid); | 225 | GNUNET_OS_process_wait (helper_proc); |
226 | GNUNET_OS_process_close (helper_proc); | ||
227 | helper_proc = NULL; | ||
224 | 228 | ||
225 | /* Tell the dns-service to rehijack the dns-port | 229 | /* Tell the dns-service to rehijack the dns-port |
226 | * The routing-table gets flushed if an interface disappears. | 230 | * The routing-table gets flushed if an interface disappears. |