aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-24 14:42:51 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-24 14:42:51 +0000
commitc5652406040cfcd7b183bbab8e963b57982f4bca (patch)
tree08b5bda9119169606ab26756afef64c91fe14fec /src/vpn
parent8f0592bb531e60bd924ee1c0e9602d10220deb70 (diff)
downloadgnunet-c5652406040cfcd7b183bbab8e963b57982f4bca.tar.gz
gnunet-c5652406040cfcd7b183bbab8e963b57982f4bca.zip
-bugfixes
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/test_gnunet_vpn.c24
-rw-r--r--src/vpn/vpn_api.c11
2 files changed, 19 insertions, 16 deletions
diff --git a/src/vpn/test_gnunet_vpn.c b/src/vpn/test_gnunet_vpn.c
index f75abac99..4d8ee7e9c 100644
--- a/src/vpn/test_gnunet_vpn.c
+++ b/src/vpn/test_gnunet_vpn.c
@@ -254,7 +254,13 @@ allocation_cb (void *cls,
254 char ips[INET_ADDRSTRLEN]; 254 char ips[INET_ADDRSTRLEN];
255 255
256 rr = NULL; 256 rr = NULL;
257 GNUNET_assert (AF_INET == af); 257 if (AF_INET != af)
258 {
259 fprintf (stderr,
260z "VPN failed to allocate appropriate address\n");
261 GNUNET_SCHEDULER_shutdown ();
262 return;
263 }
258 GNUNET_asprintf (&url, 264 GNUNET_asprintf (&url,
259 "http://%s:%u/hello_world", 265 "http://%s:%u/hello_world",
260 inet_ntop (af, address, ips, sizeof (ips)), 266 inet_ntop (af, address, ips, sizeof (ips)),
@@ -341,9 +347,6 @@ mhd_main ()
341 &nws, 347 &nws,
342 &mhd_task, 348 &mhd_task,
343 NULL); 349 NULL);
344 ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
345 &ctrl_c_shutdown,
346 NULL);
347} 350}
348 351
349 352
@@ -373,6 +376,9 @@ run (void *cls, char *const *args, const char *cfgfile,
373 GNUNET_YES, 376 GNUNET_YES,
374 GNUNET_TIME_UNIT_FOREVER_ABS, 377 GNUNET_TIME_UNIT_FOREVER_ABS,
375 &allocation_cb, NULL); 378 &allocation_cb, NULL);
379 ctrl_c_task_id = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
380 &ctrl_c_shutdown,
381 NULL);
376} 382}
377 383
378 384
@@ -430,15 +436,6 @@ main (int argc, char *const *argv)
430 GNUNET_GETOPT_OPTION_END 436 GNUNET_GETOPT_OPTION_END
431 }; 437 };
432 438
433 /* not technically true -- proper SUID and a chdir here would
434 likely do -- but this will avoid getting (useless) reports
435 from users where the test fails due to insufficient
436 permissions */
437 if (0 != getuid ())
438 {
439 fprintf (stderr, "This testcase can only be run as root\n");
440 return 0;
441 }
442 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 439 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
443 return 2; 440 return 2;
444 setup_peer (&p1, "test_gnunet_vpn.conf"); 441 setup_peer (&p1, "test_gnunet_vpn.conf");
@@ -452,5 +449,6 @@ main (int argc, char *const *argv)
452 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx, 449 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
453 "test_gnunet_vpn", "nohelp", options, &run, NULL); 450 "test_gnunet_vpn", "nohelp", options, &run, NULL);
454 stop_peer (&p1); 451 stop_peer (&p1);
452 GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn");
455 return global_ret; 453 return global_ret;
456} 454}
diff --git a/src/vpn/vpn_api.c b/src/vpn/vpn_api.c
index 3f8d04523..494c6d857 100644
--- a/src/vpn/vpn_api.c
+++ b/src/vpn/vpn_api.c
@@ -261,9 +261,13 @@ transmit_request (void *cls,
261 while ( (NULL != rr) && 261 while ( (NULL != rr) &&
262 (0 != rr->request_id) ) 262 (0 != rr->request_id) )
263 rr = rr->next; 263 rr = rr->next;
264 if ( (NULL == rr) || 264 if (NULL == rr)
265 (0 == size) )
266 return 0; 265 return 0;
266 if (0 == size)
267 {
268 reconnect (vh);
269 return 0;
270 }
267 271
268 /* if first request, start receive loop */ 272 /* if first request, start receive loop */
269 if (0 == vh->request_id_gen) 273 if (0 == vh->request_id_gen)
@@ -364,9 +368,10 @@ connect_task (void *cls,
364{ 368{
365 struct GNUNET_VPN_Handle *vh = cls; 369 struct GNUNET_VPN_Handle *vh = cls;
366 370
371 vh->rt = GNUNET_SCHEDULER_NO_TASK;
367 vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg); 372 vh->client = GNUNET_CLIENT_connect ("vpn", vh->cfg);
368 GNUNET_assert (NULL != vh->client); 373 GNUNET_assert (NULL != vh->client);
369 GNUNET_assert (NULL != vh->th); 374 GNUNET_assert (NULL == vh->th);
370 if (NULL != vh->rr_head) 375 if (NULL != vh->rr_head)
371 vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client, 376 vh->th = GNUNET_CLIENT_notify_transmit_ready (vh->client,
372 sizeof (struct RedirectToServiceRequestMessage), 377 sizeof (struct RedirectToServiceRequestMessage),