aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-10-15 16:17:25 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-10-15 16:17:25 +0000
commit745f5b00bd774fc723b644ccbea4284f5ac00771 (patch)
tree5bc601c6d1d28f382a205b7f8f194e8961cbb343 /src/testbed
parent8c9b697446f94456708796b73f27c235d50de23f (diff)
downloadgnunet-745f5b00bd774fc723b644ccbea4284f5ac00771.tar.gz
gnunet-745f5b00bd774fc723b644ccbea4284f5ac00771.zip
logging and fixes
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed.c32
-rw-r--r--src/testbed/gnunet-testbed-profiler.c6
-rw-r--r--src/testbed/testbed.h5
-rw-r--r--src/testbed/testbed_api.c2
-rw-r--r--src/testbed/testbed_api_topology.c9
5 files changed, 39 insertions, 15 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index d2231b701..6492f6e8c 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -1150,6 +1150,7 @@ forwarded_operation_timeout (void *cls,
1150 struct ForwardedOperationContext *fopc = cls; 1150 struct ForwardedOperationContext *fopc = cls;
1151 1151
1152 GNUNET_TESTBED_forward_operation_msg_cancel_ (fopc->opc); 1152 GNUNET_TESTBED_forward_operation_msg_cancel_ (fopc->opc);
1153 LOG (GNUNET_ERROR_TYPE_WARNING, "A forwarded operation has timed out\n");
1153 send_operation_fail_msg (fopc->client, fopc->operation_id, "Timeout"); 1154 send_operation_fail_msg (fopc->client, fopc->operation_id, "Timeout");
1154 GNUNET_SERVER_client_drop (fopc->client); 1155 GNUNET_SERVER_client_drop (fopc->client);
1155 GNUNET_free (fopc); 1156 GNUNET_free (fopc);
@@ -1261,6 +1262,8 @@ cleanup_focc (struct ForwardedOverlayConnectContext *focc)
1261 GNUNET_TESTBED_operation_done (focc->sub_op); 1262 GNUNET_TESTBED_operation_done (focc->sub_op);
1262 if (NULL != focc->client) 1263 if (NULL != focc->client)
1263 GNUNET_SERVER_client_drop (focc->client); 1264 GNUNET_SERVER_client_drop (focc->client);
1265 if (NULL != focc->rhandle)
1266 GNUNET_TESTBED_cancel_registration (focc->rhandle);
1264 GNUNET_free_non_null (focc->orig_msg); 1267 GNUNET_free_non_null (focc->orig_msg);
1265 GNUNET_free (focc); 1268 GNUNET_free (focc);
1266} 1269}
@@ -1501,7 +1504,7 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
1501 GNUNET_assert ('\0' == hostname[hostname_length - 1]); 1504 GNUNET_assert ('\0' == hostname[hostname_length - 1]);
1502 GNUNET_assert (strlen (hostname) == hostname_length - 1); 1505 GNUNET_assert (strlen (hostname) == hostname_length - 1);
1503 host_id = ntohl (msg->host_id); 1506 host_id = ntohl (msg->host_id);
1504 LOG_DEBUG ("Received ADDHOST message\n"); 1507 LOG_DEBUG ("Received ADDHOST %u message\n", host_id);
1505 LOG_DEBUG ("-------host id: %u\n", host_id); 1508 LOG_DEBUG ("-------host id: %u\n", host_id);
1506 LOG_DEBUG ("-------hostname: %s\n", hostname); 1509 LOG_DEBUG ("-------hostname: %s\n", hostname);
1507 if (0 != username_length) 1510 if (0 != username_length)
@@ -1516,7 +1519,6 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
1516 GNUNET_TESTBED_host_create_with_id (host_id, hostname, username, 1519 GNUNET_TESTBED_host_create_with_id (host_id, hostname, username,
1517 ntohs (msg->ssh_port)); 1520 ntohs (msg->ssh_port));
1518 GNUNET_assert (NULL != host); 1521 GNUNET_assert (NULL != host);
1519 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1520 reply_size = sizeof (struct GNUNET_TESTBED_HostConfirmedMessage); 1522 reply_size = sizeof (struct GNUNET_TESTBED_HostConfirmedMessage);
1521 if (GNUNET_OK != host_list_add (host)) 1523 if (GNUNET_OK != host_list_add (host))
1522 { 1524 {
@@ -1529,11 +1531,16 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
1529 memcpy (&reply[1], emsg, strlen (emsg) + 1); 1531 memcpy (&reply[1], emsg, strlen (emsg) + 1);
1530 } 1532 }
1531 else 1533 else
1534 {
1535 LOG_DEBUG ("Added host %u at %u\n",
1536 host_id, master_context->host_id);
1532 reply = GNUNET_malloc (reply_size); 1537 reply = GNUNET_malloc (reply_size);
1538 }
1533 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM); 1539 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM);
1534 reply->header.size = htons (reply_size); 1540 reply->header.size = htons (reply_size);
1535 reply->host_id = htonl (host_id); 1541 reply->host_id = htonl (host_id);
1536 queue_message (client, &reply->header); 1542 queue_message (client, &reply->header);
1543 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1537} 1544}
1538 1545
1539 1546
@@ -2328,6 +2335,9 @@ timeout_overlay_connect (void *cls,
2328 struct OverlayConnectContext *occ = cls; 2335 struct OverlayConnectContext *occ = cls;
2329 2336
2330 occ->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2337 occ->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2338 LOG (GNUNET_ERROR_TYPE_WARNING,
2339 "Timeout while connecting peers %u and %u\n",
2340 occ->peer_id, occ->other_peer_id);
2331 send_operation_fail_msg (occ->client, occ->op_id, occ->emsg); 2341 send_operation_fail_msg (occ->client, occ->op_id, occ->emsg);
2332 occ_cleanup (occ, tc); 2342 occ_cleanup (occ, tc);
2333} 2343}
@@ -2632,7 +2642,8 @@ focc_reg_completion_cc (void *cls, const char *emsg)
2632 GNUNET_assert (FOCC_REGISTER == focc->state); 2642 GNUNET_assert (FOCC_REGISTER == focc->state);
2633 focc->rhandle = NULL; 2643 focc->rhandle = NULL;
2634 GNUNET_assert (NULL == focc->sub_op); 2644 GNUNET_assert (NULL == focc->sub_op);
2635 LOG_DEBUG ("Registering peer2's host successful\n"); 2645 LOG_DEBUG ("[%u -> %u] Registering peer2's host successful\n",
2646 focc->peer1, focc->peer2);
2636 if ((NULL == focc->gateway2) 2647 if ((NULL == focc->gateway2)
2637 || ((focc->peer2_host_id < slave_list_size) /* Check if we have the needed config */ 2648 || ((focc->peer2_host_id < slave_list_size) /* Check if we have the needed config */
2638 && (NULL != slave_list[focc->peer2_host_id]))) 2649 && (NULL != slave_list[focc->peer2_host_id])))
@@ -2687,12 +2698,15 @@ forwarded_overlay_connect_listener (void *cls,
2687 forwarded_operation_reply_relay (cls, msg); 2698 forwarded_operation_reply_relay (cls, msg);
2688 return; 2699 return;
2689 } 2700 }
2690 LOG_DEBUG ("Registering peer2's host\n"); 2701 LOG_DEBUG ("[%u -> %u] Registering peer2's host %u at %u\n",
2702 focc->peer1, focc->peer2, focc->peer2_host_id,
2703 peer_list[focc->peer1]->details.remote.remote_host_id);
2691 focc->state = FOCC_REGISTER; 2704 focc->state = FOCC_REGISTER;
2692 focc->rhandle = 2705 focc->rhandle =
2693 GNUNET_TESTBED_register_host (focc->gateway, 2706 GNUNET_TESTBED_register_host (focc->gateway,
2694 host_list[focc->peer2_host_id], 2707 host_list[focc->peer2_host_id],
2695 focc_reg_completion_cc, focc); 2708 focc_reg_completion_cc, focc);
2709 GNUNET_assert (NULL != focc->rhandle);
2696 break; 2710 break;
2697 default: 2711 default:
2698 GNUNET_assert (0); 2712 GNUNET_assert (0);
@@ -2718,6 +2732,8 @@ forwarded_overlay_connect_timeout (void *cls,
2718 struct ForwardedOverlayConnectContext *focc = cls; 2732 struct ForwardedOverlayConnectContext *focc = cls;
2719 2733
2720 focc->timeout_task = GNUNET_SCHEDULER_NO_TASK; 2734 focc->timeout_task = GNUNET_SCHEDULER_NO_TASK;
2735 LOG_DEBUG ("Overlay linking between peers %u and %u failed during state %u\n",
2736 focc->peer1, focc->peer2, focc->state);
2721 send_operation_fail_msg (focc->client, focc->operation_id, "Timeout"); 2737 send_operation_fail_msg (focc->client, focc->operation_id, "Timeout");
2722 cleanup_focc (focc); 2738 cleanup_focc (focc);
2723} 2739}
@@ -2753,6 +2769,8 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
2753 GNUNET_assert (NULL != peer_list[p1]); 2769 GNUNET_assert (NULL != peer_list[p1]);
2754 peer = peer_list[p1]; 2770 peer = peer_list[p1];
2755 operation_id = GNUNET_ntohll (msg->operation_id); 2771 operation_id = GNUNET_ntohll (msg->operation_id);
2772 LOG_DEBUG ("Received overlay connect for peers %u and %u with op id: 0x%lx\n",
2773 p1, p2, operation_id);
2756 if (GNUNET_YES == peer->is_remote) 2774 if (GNUNET_YES == peer->is_remote)
2757 { 2775 {
2758 struct ForwardedOperationContext *fopc; 2776 struct ForwardedOperationContext *fopc;
@@ -2794,9 +2812,9 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
2794 focc->client = client; 2812 focc->client = client;
2795 focc->operation_id = operation_id; 2813 focc->operation_id = operation_id;
2796 fopc->cls = focc; 2814 fopc->cls = focc;
2797 fopc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 2815 focc->timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
2798 &forwarded_overlay_connect_timeout, 2816 &forwarded_overlay_connect_timeout,
2799 fopc); 2817 focc);
2800 } 2818 }
2801 } 2819 }
2802 fopc->opc = 2820 fopc->opc =
@@ -2824,6 +2842,8 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
2824 { 2842 {
2825 struct GNUNET_TESTBED_NeedControllerConfig *reply; 2843 struct GNUNET_TESTBED_NeedControllerConfig *reply;
2826 2844
2845 LOG_DEBUG ("Need controller configuration for connecting peers %u and %u\n",
2846 occ->peer_id, occ->other_peer_id);
2827 GNUNET_free (occ); 2847 GNUNET_free (occ);
2828 reply = GNUNET_malloc (sizeof (struct 2848 reply = GNUNET_malloc (sizeof (struct
2829 GNUNET_TESTBED_NeedControllerConfig)); 2849 GNUNET_TESTBED_NeedControllerConfig));
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index 6efe27338..7b4218890 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -33,7 +33,7 @@
33 * Generic loggins shorthand 33 * Generic loggins shorthand
34 */ 34 */
35#define LOG(kind,...) \ 35#define LOG(kind,...) \
36 GNUNET_log_from (kind, "testbed-api-testbed", __VA_ARGS__) 36 GNUNET_log (kind, __VA_ARGS__)
37 37
38/** 38/**
39 * DLL of operations 39 * DLL of operations
@@ -249,7 +249,7 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
249static void 249static void
250do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 250do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
251{ 251{
252 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Aborting\n"); 252 LOG (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
253 abort_task = GNUNET_SCHEDULER_NO_TASK; 253 abort_task = GNUNET_SCHEDULER_NO_TASK;
254 result = GNUNET_SYSERR; 254 result = GNUNET_SYSERR;
255 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 255 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
@@ -442,7 +442,7 @@ controller_event_cb (void *cls,
442 if (NULL != event->details.operation_finished.emsg) 442 if (NULL != event->details.operation_finished.emsg)
443 { 443 {
444 LOG (GNUNET_ERROR_TYPE_WARNING, 444 LOG (GNUNET_ERROR_TYPE_WARNING,
445 _("An operation has failed while starting slaves\n")); 445 _("An operation has failed while linking\n"));
446 GNUNET_SCHEDULER_cancel (abort_task); 446 GNUNET_SCHEDULER_cancel (abort_task);
447 abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); 447 abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL);
448 } 448 }
diff --git a/src/testbed/testbed.h b/src/testbed/testbed.h
index 198f764b3..9274846ca 100644
--- a/src/testbed/testbed.h
+++ b/src/testbed/testbed.h
@@ -104,7 +104,7 @@ struct GNUNET_TESTBED_HostConfirmedMessage
104{ 104{
105 105
106 /** 106 /**
107 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTSUCCESS 107 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRMED
108 */ 108 */
109 struct GNUNET_MessageHeader header; 109 struct GNUNET_MessageHeader header;
110 110
@@ -114,8 +114,7 @@ struct GNUNET_TESTBED_HostConfirmedMessage
114 uint32_t host_id GNUNET_PACKED; 114 uint32_t host_id GNUNET_PACKED;
115 115
116 /* followed by the 0-terminated error message (on failure) 116 /* followed by the 0-terminated error message (on failure)
117 * (typical errors include failure to login and 117 * (typical errors include host-id already in use) */
118 * host-id already in use) */
119 118
120}; 119};
121 120
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index a9e909f25..7f9aeff0f 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -379,7 +379,7 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
379 uint64_t op_id; 379 uint64_t op_id;
380 380
381 op_id = GNUNET_ntohll (msg->operation_id); 381 op_id = GNUNET_ntohll (msg->operation_id);
382 LOG_DEBUG ("Operation %ul successful\n", op_id); 382 LOG_DEBUG ("Operation %lu successful\n", op_id);
383 if (NULL == (opc = find_opc (c, op_id))) 383 if (NULL == (opc = find_opc (c, op_id)))
384 { 384 {
385 LOG_DEBUG ("Operation not found\n"); 385 LOG_DEBUG ("Operation not found\n");
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 47438ea3d..22e9207f3 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -29,6 +29,11 @@
29#include "testbed_api_peers.h" 29#include "testbed_api_peers.h"
30#include "testbed_api_operations.h" 30#include "testbed_api_operations.h"
31 31
32/**
33 * Generic loggins shorthand
34 */
35#define LOG(kind,...) \
36 GNUNET_log_from (kind, "testbed-api-topology", __VA_ARGS__)
32 37
33/** 38/**
34 * Representation of an overlay link 39 * Representation of an overlay link
@@ -103,8 +108,8 @@ overlay_link_completed (void *cls,
103 *link_op = NULL; 108 *link_op = NULL;
104 if (NULL != emsg) 109 if (NULL != emsg)
105 { 110 {
106 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 111 LOG (GNUNET_ERROR_TYPE_WARNING,
107 "Error while establishing a link: %s\n", emsg); 112 "Error while establishing a link: %s\n", emsg);
108 return; 113 return;
109 } 114 }
110} 115}