diff options
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 332 |
1 files changed, 182 insertions, 150 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 6dbd99bc9..e824a5f23 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -42,31 +42,39 @@ | |||
42 | /** | 42 | /** |
43 | * Generic logging shorthand | 43 | * Generic logging shorthand |
44 | */ | 44 | */ |
45 | #define LOG(kind, ...) \ | 45 | #define LOG(kind, ...) GNUNET_log_from (kind, "testbed-api-hosts", __VA_ARGS__); |
46 | GNUNET_log_from (kind, "testbed-api-hosts", __VA_ARGS__); | ||
47 | 46 | ||
48 | /** | 47 | /** |
49 | * Debug logging shorthand | 48 | * Debug logging shorthand |
50 | */ | 49 | */ |
51 | #define LOG_DEBUG(...) \ | 50 | #define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__); |
52 | LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__); | ||
53 | 51 | ||
54 | /** | 52 | /** |
55 | * Prints API violation message | 53 | * Prints API violation message |
56 | */ | 54 | */ |
57 | #define API_VIOLATION(cond,errstr) \ | 55 | #define API_VIOLATION(cond, errstr) \ |
58 | do { \ | 56 | do \ |
59 | if (cond) \ | 57 | { \ |
60 | break; \ | 58 | if (cond) \ |
59 | break; \ | ||
61 | LOG (GNUNET_ERROR_TYPE_ERROR, "API violation detected: %s\n", errstr); \ | 60 | LOG (GNUNET_ERROR_TYPE_ERROR, "API violation detected: %s\n", errstr); \ |
62 | GNUNET_assert (0); \ | 61 | GNUNET_assert (0); \ |
63 | } while (0) | 62 | } while (0) |
64 | 63 | ||
65 | /** | 64 | /** |
66 | * Log an error message at log-level 'level' that indicates a failure of the | 65 | * Log an error message at log-level 'level' that indicates a failure of the |
67 | * command 'cmd' with the message given by gai_strerror(rc). | 66 | * command 'cmd' with the message given by gai_strerror(rc). |
68 | */ | 67 | */ |
69 | #define LOG_GAI(level, cmd, rc) do { LOG(level, _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, gai_strerror(rc)); } while(0) | 68 | #define LOG_GAI(level, cmd, rc) \ |
69 | do \ | ||
70 | { \ | ||
71 | LOG (level, \ | ||
72 | _ ("`%s' failed at %s:%d with error: %s\n"), \ | ||
73 | cmd, \ | ||
74 | __FILE__, \ | ||
75 | __LINE__, \ | ||
76 | gai_strerror (rc)); \ | ||
77 | } while (0) | ||
70 | 78 | ||
71 | /** | 79 | /** |
72 | * Number of extra elements we create space for when we grow host list | 80 | * Number of extra elements we create space for when we grow host list |
@@ -157,7 +165,6 @@ struct GNUNET_TESTBED_Host | |||
157 | * The port which is to be used for SSH | 165 | * The port which is to be used for SSH |
158 | */ | 166 | */ |
159 | uint16_t port; | 167 | uint16_t port; |
160 | |||
161 | }; | 168 | }; |
162 | 169 | ||
163 | 170 | ||
@@ -201,8 +208,9 @@ GNUNET_TESTBED_host_lookup_by_id_ (uint32_t id) | |||
201 | * @return handle to the host, NULL on error | 208 | * @return handle to the host, NULL on error |
202 | */ | 209 | */ |
203 | struct GNUNET_TESTBED_Host * | 210 | struct GNUNET_TESTBED_Host * |
204 | GNUNET_TESTBED_host_create_by_id_ (uint32_t id, | 211 | GNUNET_TESTBED_host_create_by_id_ ( |
205 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 212 | uint32_t id, |
213 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
206 | { | 214 | { |
207 | return GNUNET_TESTBED_host_create_with_id (id, NULL, NULL, cfg, 0); | 215 | return GNUNET_TESTBED_host_create_with_id (id, NULL, NULL, cfg, 0); |
208 | } | 216 | } |
@@ -216,7 +224,7 @@ GNUNET_TESTBED_host_create_by_id_ (uint32_t id, | |||
216 | * 'localhost', but then obviously not globally unique) | 224 | * 'localhost', but then obviously not globally unique) |
217 | */ | 225 | */ |
218 | uint32_t | 226 | uint32_t |
219 | GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host * host) | 227 | GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host) |
220 | { | 228 | { |
221 | return host->id; | 229 | return host->id; |
222 | } | 230 | } |
@@ -255,7 +263,7 @@ GNUNET_TESTBED_host_get_username_ (const struct GNUNET_TESTBED_Host *host) | |||
255 | * @return username to login to the host | 263 | * @return username to login to the host |
256 | */ | 264 | */ |
257 | uint16_t | 265 | uint16_t |
258 | GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host * host) | 266 | GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host) |
259 | { | 267 | { |
260 | return host->port; | 268 | return host->port; |
261 | } | 269 | } |
@@ -294,8 +302,9 @@ GNUNET_TESTBED_host_get_cfg_ (const struct GNUNET_TESTBED_Host *host) | |||
294 | * @param new_cfg the new configuration to replace the old one | 302 | * @param new_cfg the new configuration to replace the old one |
295 | */ | 303 | */ |
296 | void | 304 | void |
297 | GNUNET_TESTBED_host_replace_cfg_ (struct GNUNET_TESTBED_Host *host, | 305 | GNUNET_TESTBED_host_replace_cfg_ ( |
298 | const struct GNUNET_CONFIGURATION_Handle *new_cfg) | 306 | struct GNUNET_TESTBED_Host *host, |
307 | const struct GNUNET_CONFIGURATION_Handle *new_cfg) | ||
299 | { | 308 | { |
300 | GNUNET_CONFIGURATION_destroy (host->cfg); | 309 | GNUNET_CONFIGURATION_destroy (host->cfg); |
301 | host->cfg = GNUNET_CONFIGURATION_dup (new_cfg); | 310 | host->cfg = GNUNET_CONFIGURATION_dup (new_cfg); |
@@ -316,11 +325,12 @@ GNUNET_TESTBED_host_replace_cfg_ (struct GNUNET_TESTBED_Host *host, | |||
316 | * @return handle to the host, NULL on error | 325 | * @return handle to the host, NULL on error |
317 | */ | 326 | */ |
318 | struct GNUNET_TESTBED_Host * | 327 | struct GNUNET_TESTBED_Host * |
319 | GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, | 328 | GNUNET_TESTBED_host_create_with_id ( |
320 | const char *username, | 329 | uint32_t id, |
321 | const struct GNUNET_CONFIGURATION_Handle | 330 | const char *hostname, |
322 | *cfg, | 331 | const char *username, |
323 | uint16_t port) | 332 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
333 | uint16_t port) | ||
324 | { | 334 | { |
325 | struct GNUNET_TESTBED_Host *host; | 335 | struct GNUNET_TESTBED_Host *host; |
326 | unsigned int new_size; | 336 | unsigned int new_size; |
@@ -337,8 +347,8 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, | |||
337 | host->port = (0 == port) ? 22 : port; | 347 | host->port = (0 == port) ? 22 : port; |
338 | host->cfg = GNUNET_CONFIGURATION_dup (cfg); | 348 | host->cfg = GNUNET_CONFIGURATION_dup (cfg); |
339 | host->opq_parallel_overlay_connect_operations = | 349 | host->opq_parallel_overlay_connect_operations = |
340 | GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, | 350 | GNUNET_TESTBED_operation_queue_create_ (OPERATION_QUEUE_TYPE_ADAPTIVE, |
341 | UINT_MAX); | 351 | UINT_MAX); |
342 | new_size = host_list_size; | 352 | new_size = host_list_size; |
343 | while (id >= new_size) | 353 | while (id >= new_size) |
344 | new_size += HOST_LIST_GROW_STEP; | 354 | new_size += HOST_LIST_GROW_STEP; |
@@ -363,17 +373,24 @@ GNUNET_TESTBED_host_create_with_id (uint32_t id, const char *hostname, | |||
363 | * @return handle to the host, NULL on error | 373 | * @return handle to the host, NULL on error |
364 | */ | 374 | */ |
365 | struct GNUNET_TESTBED_Host * | 375 | struct GNUNET_TESTBED_Host * |
366 | GNUNET_TESTBED_host_create (const char *hostname, const char *username, | 376 | GNUNET_TESTBED_host_create (const char *hostname, |
377 | const char *username, | ||
367 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 378 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
368 | uint16_t port) | 379 | uint16_t port) |
369 | { | 380 | { |
370 | static uint32_t uid_generator; | 381 | static uint32_t uid_generator; |
371 | 382 | ||
372 | if (NULL == hostname) | 383 | if (NULL == hostname) |
373 | return GNUNET_TESTBED_host_create_with_id (0, hostname, username, | 384 | return GNUNET_TESTBED_host_create_with_id (0, |
374 | cfg, port); | 385 | hostname, |
375 | return GNUNET_TESTBED_host_create_with_id (++uid_generator, hostname, | 386 | username, |
376 | username, cfg, port); | 387 | cfg, |
388 | port); | ||
389 | return GNUNET_TESTBED_host_create_with_id (++uid_generator, | ||
390 | hostname, | ||
391 | username, | ||
392 | cfg, | ||
393 | port); | ||
377 | } | 394 | } |
378 | 395 | ||
379 | 396 | ||
@@ -389,10 +406,10 @@ GNUNET_TESTBED_host_create (const char *hostname, const char *username, | |||
389 | * @return number of hosts returned in 'hosts', 0 on error | 406 | * @return number of hosts returned in 'hosts', 0 on error |
390 | */ | 407 | */ |
391 | unsigned int | 408 | unsigned int |
392 | GNUNET_TESTBED_hosts_load_from_file (const char *filename, | 409 | GNUNET_TESTBED_hosts_load_from_file ( |
393 | const struct GNUNET_CONFIGURATION_Handle | 410 | const char *filename, |
394 | *cfg, | 411 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
395 | struct GNUNET_TESTBED_Host ***hosts) | 412 | struct GNUNET_TESTBED_Host ***hosts) |
396 | { | 413 | { |
397 | struct GNUNET_TESTBED_Host *starting_host; | 414 | struct GNUNET_TESTBED_Host *starting_host; |
398 | char *data; | 415 | char *data; |
@@ -410,7 +427,7 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
410 | GNUNET_assert (NULL != filename); | 427 | GNUNET_assert (NULL != filename); |
411 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) | 428 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) |
412 | { | 429 | { |
413 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s not found\n"), filename); | 430 | LOG (GNUNET_ERROR_TYPE_WARNING, _ ("Hosts file %s not found\n"), filename); |
414 | return 0; | 431 | return 0; |
415 | } | 432 | } |
416 | if (GNUNET_OK != | 433 | if (GNUNET_OK != |
@@ -418,14 +435,17 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
418 | fs = 0; | 435 | fs = 0; |
419 | if (0 == fs) | 436 | if (0 == fs) |
420 | { | 437 | { |
421 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s has no data\n"), filename); | 438 | LOG (GNUNET_ERROR_TYPE_WARNING, |
439 | _ ("Hosts file %s has no data\n"), | ||
440 | filename); | ||
422 | return 0; | 441 | return 0; |
423 | } | 442 | } |
424 | data = GNUNET_malloc (fs); | 443 | data = GNUNET_malloc (fs); |
425 | if (fs != GNUNET_DISK_fn_read (filename, data, fs)) | 444 | if (fs != GNUNET_DISK_fn_read (filename, data, fs)) |
426 | { | 445 | { |
427 | GNUNET_free (data); | 446 | GNUNET_free (data); |
428 | LOG (GNUNET_ERROR_TYPE_WARNING, _("Hosts file %s cannot be read\n"), | 447 | LOG (GNUNET_ERROR_TYPE_WARNING, |
448 | _ ("Hosts file %s cannot be read\n"), | ||
429 | filename); | 449 | filename); |
430 | return 0; | 450 | return 0; |
431 | } | 451 | } |
@@ -450,11 +470,12 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
450 | username = NULL; | 470 | username = NULL; |
451 | hostname = NULL; | 471 | hostname = NULL; |
452 | port = 0; | 472 | port = 0; |
453 | if ((REG_NOMATCH == regexec (&rex, buf, 6, pmatch, 0)) | 473 | if ((REG_NOMATCH == regexec (&rex, buf, 6, pmatch, 0)) || |
454 | || (-1 == pmatch[3].rm_so)) | 474 | (-1 == pmatch[3].rm_so)) |
455 | { | 475 | { |
456 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 476 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
457 | "Error reading line `%s' in hostfile\n", buf); | 477 | "Error reading line `%s' in hostfile\n", |
478 | buf); | ||
458 | buf = &data[offset + 1]; | 479 | buf = &data[offset + 1]; |
459 | continue; | 480 | continue; |
460 | } | 481 | } |
@@ -462,19 +483,17 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
462 | { | 483 | { |
463 | size = pmatch[2].rm_eo - pmatch[2].rm_so; | 484 | size = pmatch[2].rm_eo - pmatch[2].rm_so; |
464 | username = GNUNET_malloc (size + 1); | 485 | username = GNUNET_malloc (size + 1); |
465 | GNUNET_assert(0 != GNUNET_strlcpy (username, | 486 | GNUNET_assert ( |
466 | buf + pmatch[2].rm_so, | 487 | 0 != GNUNET_strlcpy (username, buf + pmatch[2].rm_so, size + 1)); |
467 | size + 1)); | ||
468 | } | 488 | } |
469 | if (-1 != pmatch[5].rm_so) | 489 | if (-1 != pmatch[5].rm_so) |
470 | { | 490 | { |
471 | (void) SSCANF (buf + pmatch[5].rm_so, "%5hd", &port); | 491 | (void) sscanf (buf + pmatch[5].rm_so, "%5hd", &port); |
472 | } | 492 | } |
473 | size = pmatch[3].rm_eo - pmatch[3].rm_so; | 493 | size = pmatch[3].rm_eo - pmatch[3].rm_so; |
474 | hostname = GNUNET_malloc (size + 1); | 494 | hostname = GNUNET_malloc (size + 1); |
475 | GNUNET_assert(0 != GNUNET_strlcpy (hostname, | 495 | GNUNET_assert ( |
476 | buf + pmatch[3].rm_so, | 496 | 0 != GNUNET_strlcpy (hostname, buf + pmatch[3].rm_so, size + 1)); |
477 | size + 1)); | ||
478 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 497 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
479 | "Successfully read host %s, port %d and user %s from file\n", | 498 | "Successfully read host %s, port %d and user %s from file\n", |
480 | (NULL == hostname) ? "NULL" : hostname, | 499 | (NULL == hostname) ? "NULL" : hostname, |
@@ -483,8 +502,8 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
483 | /* We store hosts in a static list; hence we only require the starting | 502 | /* We store hosts in a static list; hence we only require the starting |
484 | * host pointer in that list to access the newly created list of hosts */ | 503 | * host pointer in that list to access the newly created list of hosts */ |
485 | if (NULL == starting_host) | 504 | if (NULL == starting_host) |
486 | starting_host = GNUNET_TESTBED_host_create (hostname, username, cfg, | 505 | starting_host = |
487 | port); | 506 | GNUNET_TESTBED_host_create (hostname, username, cfg, port); |
488 | else | 507 | else |
489 | (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port); | 508 | (void) GNUNET_TESTBED_host_create (hostname, username, cfg, port); |
490 | count++; | 509 | count++; |
@@ -522,7 +541,7 @@ simple_resolve (const char *host) | |||
522 | struct addrinfo hint; | 541 | struct addrinfo hint; |
523 | unsigned int rc; | 542 | unsigned int rc; |
524 | 543 | ||
525 | hint.ai_family = AF_INET; /* IPv4 */ | 544 | hint.ai_family = AF_INET; /* IPv4 */ |
526 | hint.ai_socktype = 0; | 545 | hint.ai_socktype = 0; |
527 | hint.ai_protocol = 0; | 546 | hint.ai_protocol = 0; |
528 | hint.ai_addrlen = 0; | 547 | hint.ai_addrlen = 0; |
@@ -562,13 +581,13 @@ simple_resolve (const char *host) | |||
562 | * @return number of hosts returned in 'hosts', 0 on error | 581 | * @return number of hosts returned in 'hosts', 0 on error |
563 | */ | 582 | */ |
564 | unsigned int | 583 | unsigned int |
565 | GNUNET_TESTBED_hosts_load_from_loadleveler (const struct | 584 | GNUNET_TESTBED_hosts_load_from_loadleveler ( |
566 | GNUNET_CONFIGURATION_Handle *cfg, | 585 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
567 | struct GNUNET_TESTBED_Host ***hosts) | 586 | struct GNUNET_TESTBED_Host ***hosts) |
568 | { | 587 | { |
569 | #if !ENABLE_SUPERMUC | 588 | #if ! ENABLE_SUPERMUC |
570 | LOG (GNUNET_ERROR_TYPE_ERROR, | 589 | LOG (GNUNET_ERROR_TYPE_ERROR, |
571 | _("The function %s is only available when compiled with (--with-ll)\n"), | 590 | _ ("The function %s is only available when compiled with (--with-ll)\n"), |
572 | __func__); | 591 | __func__); |
573 | GNUNET_assert (0); | 592 | GNUNET_assert (0); |
574 | #else | 593 | #else |
@@ -607,8 +626,8 @@ GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host) | |||
607 | } | 626 | } |
608 | GNUNET_free_non_null ((char *) host->username); | 627 | GNUNET_free_non_null ((char *) host->username); |
609 | GNUNET_free_non_null ((char *) host->hostname); | 628 | GNUNET_free_non_null ((char *) host->hostname); |
610 | GNUNET_TESTBED_operation_queue_destroy_ | 629 | GNUNET_TESTBED_operation_queue_destroy_ ( |
611 | (host->opq_parallel_overlay_connect_operations); | 630 | host->opq_parallel_overlay_connect_operations); |
612 | GNUNET_CONFIGURATION_destroy (host->cfg); | 631 | GNUNET_CONFIGURATION_destroy (host->cfg); |
613 | GNUNET_free (host); | 632 | GNUNET_free (host); |
614 | while (host_list_size >= HOST_LIST_GROW_STEP) | 633 | while (host_list_size >= HOST_LIST_GROW_STEP) |
@@ -624,8 +643,8 @@ GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host) | |||
624 | host_list_size -= HOST_LIST_GROW_STEP; | 643 | host_list_size -= HOST_LIST_GROW_STEP; |
625 | } | 644 | } |
626 | host_list = | 645 | host_list = |
627 | GNUNET_realloc (host_list, | 646 | GNUNET_realloc (host_list, |
628 | sizeof (struct GNUNET_TESTBED_Host *) * host_list_size); | 647 | sizeof (struct GNUNET_TESTBED_Host *) * host_list_size); |
629 | } | 648 | } |
630 | 649 | ||
631 | 650 | ||
@@ -636,15 +655,15 @@ GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host) | |||
636 | * @param controller the controller at which this host is registered | 655 | * @param controller the controller at which this host is registered |
637 | */ | 656 | */ |
638 | void | 657 | void |
639 | GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host, | 658 | GNUNET_TESTBED_mark_host_registered_at_ ( |
640 | const struct GNUNET_TESTBED_Controller | 659 | struct GNUNET_TESTBED_Host *host, |
641 | *const controller) | 660 | const struct GNUNET_TESTBED_Controller *const controller) |
642 | { | 661 | { |
643 | struct RegisteredController *rc; | 662 | struct RegisteredController *rc; |
644 | 663 | ||
645 | for (rc = host->rc_head; NULL != rc; rc = rc->next) | 664 | for (rc = host->rc_head; NULL != rc; rc = rc->next) |
646 | { | 665 | { |
647 | if (controller == rc->controller) /* already registered at controller */ | 666 | if (controller == rc->controller) /* already registered at controller */ |
648 | { | 667 | { |
649 | GNUNET_break (0); | 668 | GNUNET_break (0); |
650 | return; | 669 | return; |
@@ -663,13 +682,13 @@ GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host, | |||
663 | * @param controller the controller at which this host has to be unmarked | 682 | * @param controller the controller at which this host has to be unmarked |
664 | */ | 683 | */ |
665 | void | 684 | void |
666 | GNUNET_TESTBED_deregister_host_at_ (struct GNUNET_TESTBED_Host *host, | 685 | GNUNET_TESTBED_deregister_host_at_ ( |
667 | const struct GNUNET_TESTBED_Controller | 686 | struct GNUNET_TESTBED_Host *host, |
668 | *const controller) | 687 | const struct GNUNET_TESTBED_Controller *const controller) |
669 | { | 688 | { |
670 | struct RegisteredController *rc; | 689 | struct RegisteredController *rc; |
671 | 690 | ||
672 | for (rc = host->rc_head; NULL != rc; rc=rc->next) | 691 | for (rc = host->rc_head; NULL != rc; rc = rc->next) |
673 | if (controller == rc->controller) | 692 | if (controller == rc->controller) |
674 | break; | 693 | break; |
675 | if (NULL == rc) | 694 | if (NULL == rc) |
@@ -690,15 +709,15 @@ GNUNET_TESTBED_deregister_host_at_ (struct GNUNET_TESTBED_Host *host, | |||
690 | * @return GNUNET_YES if registered; GNUNET_NO if not | 709 | * @return GNUNET_YES if registered; GNUNET_NO if not |
691 | */ | 710 | */ |
692 | int | 711 | int |
693 | GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host, | 712 | GNUNET_TESTBED_is_host_registered_ ( |
694 | const struct GNUNET_TESTBED_Controller | 713 | const struct GNUNET_TESTBED_Host *host, |
695 | *const controller) | 714 | const struct GNUNET_TESTBED_Controller *const controller) |
696 | { | 715 | { |
697 | struct RegisteredController *rc; | 716 | struct RegisteredController *rc; |
698 | 717 | ||
699 | for (rc = host->rc_head; NULL != rc; rc = rc->next) | 718 | for (rc = host->rc_head; NULL != rc; rc = rc->next) |
700 | { | 719 | { |
701 | if (controller == rc->controller) /* already registered at controller */ | 720 | if (controller == rc->controller) /* already registered at controller */ |
702 | { | 721 | { |
703 | return GNUNET_YES; | 722 | return GNUNET_YES; |
704 | } | 723 | } |
@@ -746,7 +765,6 @@ struct GNUNET_TESTBED_ControllerProc | |||
746 | * The message corresponding to send handle | 765 | * The message corresponding to send handle |
747 | */ | 766 | */ |
748 | struct GNUNET_MessageHeader *msg; | 767 | struct GNUNET_MessageHeader *msg; |
749 | |||
750 | }; | 768 | }; |
751 | 769 | ||
752 | 770 | ||
@@ -763,7 +781,8 @@ copy_argv (const char *const *argv) | |||
763 | unsigned int argp; | 781 | unsigned int argp; |
764 | 782 | ||
765 | GNUNET_assert (NULL != argv); | 783 | GNUNET_assert (NULL != argv); |
766 | for (argp = 0; NULL != argv[argp]; argp++) ; | 784 | for (argp = 0; NULL != argv[argp]; argp++) |
785 | ; | ||
767 | argv_dup = GNUNET_malloc (sizeof (char *) * (argp + 1)); | 786 | argv_dup = GNUNET_malloc (sizeof (char *) * (argp + 1)); |
768 | for (argp = 0; NULL != argv[argp]; argp++) | 787 | for (argp = 0; NULL != argv[argp]; argp++) |
769 | argv_dup[argp] = GNUNET_strdup (argv[argp]); | 788 | argv_dup[argp] = GNUNET_strdup (argv[argp]); |
@@ -836,19 +855,18 @@ free_argv (char **argv) | |||
836 | static char ** | 855 | static char ** |
837 | gen_rsh_args (const char *port, const char *hostname, const char *username) | 856 | gen_rsh_args (const char *port, const char *hostname, const char *username) |
838 | { | 857 | { |
839 | static const char *default_ssh_args[] = { | 858 | static const char *default_ssh_args[] = |
840 | "ssh", | 859 | {"ssh", |
841 | "-o", | 860 | "-o", |
842 | "BatchMode=yes", | 861 | "BatchMode=yes", |
843 | "-o", | 862 | "-o", |
844 | "NoHostAuthenticationForLocalhost=yes", | 863 | "NoHostAuthenticationForLocalhost=yes", |
845 | "-o", | 864 | "-o", |
846 | "StrictHostKeyChecking=no", | 865 | "StrictHostKeyChecking=no", |
847 | "-o", | 866 | "-o", |
848 | "PasswordAuthentication=no", | 867 | "PasswordAuthentication=no", |
849 | "%h", | 868 | "%h", |
850 | NULL | 869 | NULL}; |
851 | }; | ||
852 | char **ssh_args; | 870 | char **ssh_args; |
853 | char *ssh_cmd; | 871 | char *ssh_cmd; |
854 | char *ssh_cmd_cp; | 872 | char *ssh_cmd_cp; |
@@ -915,7 +933,7 @@ gen_rsh_args (const char *port, const char *hostname, const char *username) | |||
915 | * @return NULL-terminated args | 933 | * @return NULL-terminated args |
916 | */ | 934 | */ |
917 | static char ** | 935 | static char ** |
918 | gen_rsh_suffix_args (const char * const *append_args) | 936 | gen_rsh_suffix_args (const char *const *append_args) |
919 | { | 937 | { |
920 | char **rshell_args; | 938 | char **rshell_args; |
921 | char *rshell_cmd; | 939 | char *rshell_cmd; |
@@ -937,7 +955,9 @@ gen_rsh_suffix_args (const char * const *append_args) | |||
937 | if (NULL != append_args) | 955 | if (NULL != append_args) |
938 | { | 956 | { |
939 | for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) | 957 | for (append_cnt = 0; NULL != append_args[append_cnt]; append_cnt++) |
940 | GNUNET_array_append (rshell_args, cnt, GNUNET_strdup (append_args[append_cnt])); | 958 | GNUNET_array_append (rshell_args, |
959 | cnt, | ||
960 | GNUNET_strdup (append_args[append_cnt])); | ||
941 | } | 961 | } |
942 | GNUNET_array_append (rshell_args, cnt, NULL); | 962 | GNUNET_array_append (rshell_args, cnt, NULL); |
943 | return rshell_args; | 963 | return rshell_args; |
@@ -957,8 +977,7 @@ gen_rsh_suffix_args (const char * const *append_args) | |||
957 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | 977 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing |
958 | */ | 978 | */ |
959 | static int | 979 | static int |
960 | helper_mst (void *cls, | 980 | helper_mst (void *cls, const struct GNUNET_MessageHeader *message) |
961 | const struct GNUNET_MessageHeader *message) | ||
962 | { | 981 | { |
963 | struct GNUNET_TESTBED_ControllerProc *cp = cls; | 982 | struct GNUNET_TESTBED_ControllerProc *cp = cls; |
964 | const struct GNUNET_TESTBED_HelperReply *msg; | 983 | const struct GNUNET_TESTBED_HelperReply *msg; |
@@ -973,27 +992,28 @@ helper_mst (void *cls, | |||
973 | GNUNET_assert (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY == | 992 | GNUNET_assert (GNUNET_MESSAGE_TYPE_TESTBED_HELPER_REPLY == |
974 | ntohs (msg->header.type)); | 993 | ntohs (msg->header.type)); |
975 | config_size = (uLongf) ntohs (msg->config_size); | 994 | config_size = (uLongf) ntohs (msg->config_size); |
976 | xconfig_size = | 995 | xconfig_size = (uLongf) (ntohs (msg->header.size) - |
977 | (uLongf) (ntohs (msg->header.size) - | 996 | sizeof (struct GNUNET_TESTBED_HelperReply)); |
978 | sizeof (struct GNUNET_TESTBED_HelperReply)); | ||
979 | config = GNUNET_malloc (config_size); | 997 | config = GNUNET_malloc (config_size); |
980 | GNUNET_assert (Z_OK == | 998 | GNUNET_assert (Z_OK == uncompress ((Bytef *) config, |
981 | uncompress ((Bytef *) config, &config_size, | 999 | &config_size, |
982 | (const Bytef *) &msg[1], xconfig_size)); | 1000 | (const Bytef *) &msg[1], |
1001 | xconfig_size)); | ||
983 | /* Replace the configuration template present in the host with the | 1002 | /* Replace the configuration template present in the host with the |
984 | controller's running configuration */ | 1003 | controller's running configuration */ |
985 | GNUNET_CONFIGURATION_destroy (cp->host->cfg); | 1004 | GNUNET_CONFIGURATION_destroy (cp->host->cfg); |
986 | cp->host->cfg = GNUNET_CONFIGURATION_create (); | 1005 | cp->host->cfg = GNUNET_CONFIGURATION_create (); |
987 | GNUNET_assert (GNUNET_CONFIGURATION_deserialize | 1006 | GNUNET_assert (GNUNET_CONFIGURATION_deserialize (cp->host->cfg, |
988 | (cp->host->cfg, | 1007 | config, |
989 | config, | 1008 | config_size, |
990 | config_size, | 1009 | NULL)); |
991 | NULL)); | ||
992 | GNUNET_free (config); | 1010 | GNUNET_free (config); |
993 | if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host))) | 1011 | if (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host))) |
994 | hostname = "localhost"; | 1012 | hostname = "localhost"; |
995 | /* Change the hostname so that we can connect to it */ | 1013 | /* Change the hostname so that we can connect to it */ |
996 | GNUNET_CONFIGURATION_set_value_string (cp->host->cfg, "testbed", "hostname", | 1014 | GNUNET_CONFIGURATION_set_value_string (cp->host->cfg, |
1015 | "testbed", | ||
1016 | "hostname", | ||
997 | hostname); | 1017 | hostname); |
998 | cp->host->locked = GNUNET_NO; | 1018 | cp->host->locked = GNUNET_NO; |
999 | cp->host->controller_started = GNUNET_YES; | 1019 | cp->host->controller_started = GNUNET_YES; |
@@ -1077,24 +1097,27 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, | |||
1077 | struct GNUNET_TESTBED_HelperInit *msg; | 1097 | struct GNUNET_TESTBED_HelperInit *msg; |
1078 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 1098 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
1079 | const char *hostname; | 1099 | const char *hostname; |
1080 | static char *const binary_argv[] = { | 1100 | static char *const binary_argv[] = {HELPER_TESTBED_BINARY, NULL}; |
1081 | HELPER_TESTBED_BINARY, NULL | ||
1082 | }; | ||
1083 | 1101 | ||
1084 | GNUNET_assert (NULL != host); | 1102 | GNUNET_assert (NULL != host); |
1085 | GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host))); | 1103 | GNUNET_assert (NULL != (cfg = GNUNET_TESTBED_host_get_cfg_ (host))); |
1086 | hostname = NULL; | 1104 | hostname = NULL; |
1087 | API_VIOLATION (GNUNET_NO == host->locked, | 1105 | API_VIOLATION ( |
1088 | "Host is already locked by a previous call to GNUNET_TESTBED_controller_start()"); | 1106 | GNUNET_NO == host->locked, |
1107 | "Host is already locked by a previous call to GNUNET_TESTBED_controller_start()"); | ||
1089 | host->locked = GNUNET_YES; | 1108 | host->locked = GNUNET_YES; |
1090 | API_VIOLATION (GNUNET_NO == host->controller_started, | 1109 | API_VIOLATION ( |
1091 | "Attempting to start a controller on a host which is already started a controller"); | 1110 | GNUNET_NO == host->controller_started, |
1111 | "Attempting to start a controller on a host which is already started a controller"); | ||
1092 | cp = GNUNET_new (struct GNUNET_TESTBED_ControllerProc); | 1112 | cp = GNUNET_new (struct GNUNET_TESTBED_ControllerProc); |
1093 | if (0 == GNUNET_TESTBED_host_get_id_ (host)) | 1113 | if (0 == GNUNET_TESTBED_host_get_id_ (host)) |
1094 | { | 1114 | { |
1095 | cp->helper = | 1115 | cp->helper = GNUNET_HELPER_start (GNUNET_YES, |
1096 | GNUNET_HELPER_start (GNUNET_YES, HELPER_TESTBED_BINARY, binary_argv, | 1116 | HELPER_TESTBED_BINARY, |
1097 | &helper_mst, &helper_exp_cb, cp); | 1117 | binary_argv, |
1118 | &helper_mst, | ||
1119 | &helper_exp_cb, | ||
1120 | cp); | ||
1098 | } | 1121 | } |
1099 | else | 1122 | else |
1100 | { | 1123 | { |
@@ -1112,16 +1135,18 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, | |||
1112 | GNUNET_asprintf (&port, "%u", host->port); | 1135 | GNUNET_asprintf (&port, "%u", host->port); |
1113 | LOG_DEBUG ("Starting remote connection to destination %s\n", hostname); | 1136 | LOG_DEBUG ("Starting remote connection to destination %s\n", hostname); |
1114 | if (GNUNET_OK != | 1137 | if (GNUNET_OK != |
1115 | GNUNET_CONFIGURATION_get_value_filename (cfg, "testbed", | 1138 | GNUNET_CONFIGURATION_get_value_filename (cfg, |
1116 | "HELPER_BINARY_PATH", | 1139 | "testbed", |
1117 | &helper_binary_path_args[0])) | 1140 | "HELPER_BINARY_PATH", |
1141 | &helper_binary_path_args[0])) | ||
1118 | helper_binary_path_args[0] = | 1142 | helper_binary_path_args[0] = |
1119 | GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); | 1143 | GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); |
1120 | helper_binary_path_args[1] = NULL; | 1144 | helper_binary_path_args[1] = NULL; |
1121 | rsh_args = gen_rsh_args (port, hostname, username); | 1145 | rsh_args = gen_rsh_args (port, hostname, username); |
1122 | rsh_suffix_args = gen_rsh_suffix_args ((const char **) helper_binary_path_args); | 1146 | rsh_suffix_args = |
1147 | gen_rsh_suffix_args ((const char **) helper_binary_path_args); | ||
1123 | cp->helper_argv = | 1148 | cp->helper_argv = |
1124 | join_argv ((const char **) rsh_args, (const char **) rsh_suffix_args); | 1149 | join_argv ((const char **) rsh_args, (const char **) rsh_suffix_args); |
1125 | free_argv (rsh_args); | 1150 | free_argv (rsh_args); |
1126 | free_argv (rsh_suffix_args); | 1151 | free_argv (rsh_suffix_args); |
1127 | GNUNET_free (port); | 1152 | GNUNET_free (port); |
@@ -1129,14 +1154,18 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, | |||
1129 | for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++) | 1154 | for (cnt = 0; NULL != cp->helper_argv[cnt]; cnt++) |
1130 | { | 1155 | { |
1131 | aux = argstr; | 1156 | aux = argstr; |
1132 | GNUNET_assert (0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt])); | 1157 | GNUNET_assert ( |
1158 | 0 < GNUNET_asprintf (&argstr, "%s %s", aux, cp->helper_argv[cnt])); | ||
1133 | GNUNET_free (aux); | 1159 | GNUNET_free (aux); |
1134 | } | 1160 | } |
1135 | LOG_DEBUG ("Helper cmd str: %s\n", argstr); | 1161 | LOG_DEBUG ("Helper cmd str: %s\n", argstr); |
1136 | GNUNET_free (argstr); | 1162 | GNUNET_free (argstr); |
1137 | cp->helper = | 1163 | cp->helper = GNUNET_HELPER_start (GNUNET_NO, |
1138 | GNUNET_HELPER_start (GNUNET_NO, cp->helper_argv[0], cp->helper_argv, &helper_mst, | 1164 | cp->helper_argv[0], |
1139 | &helper_exp_cb, cp); | 1165 | cp->helper_argv, |
1166 | &helper_mst, | ||
1167 | &helper_exp_cb, | ||
1168 | cp); | ||
1140 | GNUNET_free (helper_binary_path_args[0]); | 1169 | GNUNET_free (helper_binary_path_args[0]); |
1141 | } | 1170 | } |
1142 | if (NULL == cp->helper) | 1171 | if (NULL == cp->helper) |
@@ -1152,7 +1181,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, | |||
1152 | msg = GNUNET_TESTBED_create_helper_init_msg_ (trusted_ip, hostname, cfg); | 1181 | msg = GNUNET_TESTBED_create_helper_init_msg_ (trusted_ip, hostname, cfg); |
1153 | cp->msg = &msg->header; | 1182 | cp->msg = &msg->header; |
1154 | cp->shandle = | 1183 | cp->shandle = |
1155 | GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO, &clear_msg, cp); | 1184 | GNUNET_HELPER_send (cp->helper, &msg->header, GNUNET_NO, &clear_msg, cp); |
1156 | if (NULL == cp->shandle) | 1185 | if (NULL == cp->shandle) |
1157 | { | 1186 | { |
1158 | GNUNET_free (msg); | 1187 | GNUNET_free (msg); |
@@ -1249,14 +1278,13 @@ struct GNUNET_TESTBED_HostHabitableCheckHandle | |||
1249 | /** | 1278 | /** |
1250 | * Task id for the habitability check task | 1279 | * Task id for the habitability check task |
1251 | */ | 1280 | */ |
1252 | struct GNUNET_SCHEDULER_Task * habitability_check_task; | 1281 | struct GNUNET_SCHEDULER_Task *habitability_check_task; |
1253 | 1282 | ||
1254 | /** | 1283 | /** |
1255 | * How long we wait before checking the process status. Should grow | 1284 | * How long we wait before checking the process status. Should grow |
1256 | * exponentially | 1285 | * exponentially |
1257 | */ | 1286 | */ |
1258 | struct GNUNET_TIME_Relative wait_time; | 1287 | struct GNUNET_TIME_Relative wait_time; |
1259 | |||
1260 | }; | 1288 | }; |
1261 | 1289 | ||
1262 | 1290 | ||
@@ -1288,7 +1316,7 @@ habitability_check (void *cls) | |||
1288 | { | 1316 | { |
1289 | h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time); | 1317 | h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time); |
1290 | h->habitability_check_task = | 1318 | h->habitability_check_task = |
1291 | GNUNET_SCHEDULER_add_delayed (h->wait_time, &habitability_check, h); | 1319 | GNUNET_SCHEDULER_add_delayed (h->wait_time, &habitability_check, h); |
1292 | return; | 1320 | return; |
1293 | } | 1321 | } |
1294 | GNUNET_OS_process_destroy (h->auxp); | 1322 | GNUNET_OS_process_destroy (h->auxp); |
@@ -1320,11 +1348,11 @@ call_cb: | |||
1320 | * GNUNET_TESTBED_is_host_habitable_cancel() | 1348 | * GNUNET_TESTBED_is_host_habitable_cancel() |
1321 | */ | 1349 | */ |
1322 | struct GNUNET_TESTBED_HostHabitableCheckHandle * | 1350 | struct GNUNET_TESTBED_HostHabitableCheckHandle * |
1323 | GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | 1351 | GNUNET_TESTBED_is_host_habitable ( |
1324 | const struct GNUNET_CONFIGURATION_Handle | 1352 | const struct GNUNET_TESTBED_Host *host, |
1325 | *config, | 1353 | const struct GNUNET_CONFIGURATION_Handle *config, |
1326 | GNUNET_TESTBED_HostHabitableCallback cb, | 1354 | GNUNET_TESTBED_HostHabitableCallback cb, |
1327 | void *cb_cls) | 1355 | void *cb_cls) |
1328 | { | 1356 | { |
1329 | struct GNUNET_TESTBED_HostHabitableCheckHandle *h; | 1357 | struct GNUNET_TESTBED_HostHabitableCheckHandle *h; |
1330 | char **rsh_args; | 1358 | char **rsh_args; |
@@ -1339,11 +1367,11 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | |||
1339 | h->host = host; | 1367 | h->host = host; |
1340 | hostname = (NULL == host->hostname) ? "127.0.0.1" : host->hostname; | 1368 | hostname = (NULL == host->hostname) ? "127.0.0.1" : host->hostname; |
1341 | if (GNUNET_OK != | 1369 | if (GNUNET_OK != |
1342 | GNUNET_CONFIGURATION_get_value_filename (config, "testbed", | 1370 | GNUNET_CONFIGURATION_get_value_filename (config, |
1343 | "HELPER_BINARY_PATH", | 1371 | "testbed", |
1344 | &stat_args[1])) | 1372 | "HELPER_BINARY_PATH", |
1345 | stat_args[1] = | 1373 | &stat_args[1])) |
1346 | GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); | 1374 | stat_args[1] = GNUNET_OS_get_libexec_binary_path (HELPER_TESTBED_BINARY); |
1347 | GNUNET_asprintf (&port, "%u", host->port); | 1375 | GNUNET_asprintf (&port, "%u", host->port); |
1348 | rsh_args = gen_rsh_args (port, hostname, host->username); | 1376 | rsh_args = gen_rsh_args (port, hostname, host->username); |
1349 | GNUNET_free (port); | 1377 | GNUNET_free (port); |
@@ -1352,22 +1380,26 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | |||
1352 | stat_args[2] = NULL; | 1380 | stat_args[2] = NULL; |
1353 | rsh_suffix_args = gen_rsh_suffix_args ((const char **) stat_args); | 1381 | rsh_suffix_args = gen_rsh_suffix_args ((const char **) stat_args); |
1354 | GNUNET_free (stat_args[1]); | 1382 | GNUNET_free (stat_args[1]); |
1355 | h->helper_argv = join_argv ((const char **) rsh_args, | 1383 | h->helper_argv = |
1356 | (const char **) rsh_suffix_args); | 1384 | join_argv ((const char **) rsh_args, (const char **) rsh_suffix_args); |
1357 | free_argv (rsh_suffix_args); | 1385 | free_argv (rsh_suffix_args); |
1358 | free_argv (rsh_args); | 1386 | free_argv (rsh_args); |
1359 | h->auxp = | 1387 | h->auxp = GNUNET_OS_start_process_vap (GNUNET_NO, |
1360 | GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, NULL, | 1388 | GNUNET_OS_INHERIT_STD_ERR, |
1361 | NULL, NULL, h->helper_argv[0], h->helper_argv); | 1389 | NULL, |
1390 | NULL, | ||
1391 | NULL, | ||
1392 | h->helper_argv[0], | ||
1393 | h->helper_argv); | ||
1362 | if (NULL == h->auxp) | 1394 | if (NULL == h->auxp) |
1363 | { | 1395 | { |
1364 | GNUNET_break (0); /* Cannot exec SSH? */ | 1396 | GNUNET_break (0); /* Cannot exec SSH? */ |
1365 | GNUNET_free (h); | 1397 | GNUNET_free (h); |
1366 | return NULL; | 1398 | return NULL; |
1367 | } | 1399 | } |
1368 | h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time); | 1400 | h->wait_time = GNUNET_TIME_STD_BACKOFF (h->wait_time); |
1369 | h->habitability_check_task = | 1401 | h->habitability_check_task = |
1370 | GNUNET_SCHEDULER_add_delayed (h->wait_time, &habitability_check, h); | 1402 | GNUNET_SCHEDULER_add_delayed (h->wait_time, &habitability_check, h); |
1371 | return h; | 1403 | return h; |
1372 | } | 1404 | } |
1373 | 1405 | ||
@@ -1378,9 +1410,8 @@ GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host, | |||
1378 | * @param handle the habitability check handle | 1410 | * @param handle the habitability check handle |
1379 | */ | 1411 | */ |
1380 | void | 1412 | void |
1381 | GNUNET_TESTBED_is_host_habitable_cancel (struct | 1413 | GNUNET_TESTBED_is_host_habitable_cancel ( |
1382 | GNUNET_TESTBED_HostHabitableCheckHandle | 1414 | struct GNUNET_TESTBED_HostHabitableCheckHandle *handle) |
1383 | *handle) | ||
1384 | { | 1415 | { |
1385 | GNUNET_SCHEDULER_cancel (handle->habitability_check_task); | 1416 | GNUNET_SCHEDULER_cancel (handle->habitability_check_task); |
1386 | (void) GNUNET_OS_process_kill (handle->auxp, GNUNET_TERM_SIG); | 1417 | (void) GNUNET_OS_process_kill (handle->auxp, GNUNET_TERM_SIG); |
@@ -1427,7 +1458,8 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, | |||
1427 | hostname = GNUNET_TESTBED_host_get_hostname (host); | 1458 | hostname = GNUNET_TESTBED_host_get_hostname (host); |
1428 | if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller)) | 1459 | if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller)) |
1429 | { | 1460 | { |
1430 | LOG (GNUNET_ERROR_TYPE_WARNING, "Host hostname: %s already registered\n", | 1461 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1462 | "Host hostname: %s already registered\n", | ||
1431 | (NULL == hostname) ? "localhost" : hostname); | 1463 | (NULL == hostname) ? "localhost" : hostname); |
1432 | return NULL; | 1464 | return NULL; |
1433 | } | 1465 | } |
@@ -1486,8 +1518,8 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, | |||
1486 | * @param handle the registration handle to cancel | 1518 | * @param handle the registration handle to cancel |
1487 | */ | 1519 | */ |
1488 | void | 1520 | void |
1489 | GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle | 1521 | GNUNET_TESTBED_cancel_registration ( |
1490 | *handle) | 1522 | struct GNUNET_TESTBED_HostRegistrationHandle *handle) |
1491 | { | 1523 | { |
1492 | if (handle != handle->c->rh) | 1524 | if (handle != handle->c->rh) |
1493 | { | 1525 | { |
@@ -1511,8 +1543,8 @@ void | |||
1511 | GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, | 1543 | GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, |
1512 | struct GNUNET_TESTBED_Operation *op) | 1544 | struct GNUNET_TESTBED_Operation *op) |
1513 | { | 1545 | { |
1514 | GNUNET_TESTBED_operation_queue_insert_ | 1546 | GNUNET_TESTBED_operation_queue_insert_ (h->opq_parallel_overlay_connect_operations, |
1515 | (h->opq_parallel_overlay_connect_operations, op); | 1547 | op); |
1516 | } | 1548 | } |
1517 | 1549 | ||
1518 | 1550 | ||