diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-01-21 13:36:54 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-01-21 13:36:54 +0000 |
commit | e609f9a36d3287ff6e355584a4ac3e0ba6f5e2ca (patch) | |
tree | 92ed3a2eae8840cd01f215fa9d3bb54447a09402 /src | |
parent | d501498cb7a73f2b1a4178d67442ea725a432c45 (diff) | |
download | gnunet-e609f9a36d3287ff6e355584a4ac3e0ba6f5e2ca.tar.gz gnunet-e609f9a36d3287ff6e355584a4ac3e0ba6f5e2ca.zip |
- debug messages
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index e3b389ddb..208c326a5 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -56,6 +56,7 @@ | |||
56 | 56 | ||
57 | #define MESH_BLOOM_SIZE 128 | 57 | #define MESH_BLOOM_SIZE 128 |
58 | 58 | ||
59 | #define MESH_DEBUG_REGEX GNUNET_YES | ||
59 | #define MESH_DEBUG_DHT GNUNET_NO | 60 | #define MESH_DEBUG_DHT GNUNET_NO |
60 | #define MESH_DEBUG_CONNECTION GNUNET_NO | 61 | #define MESH_DEBUG_CONNECTION GNUNET_NO |
61 | #define MESH_DEBUG_TIMING __LINUX__ && GNUNET_NO | 62 | #define MESH_DEBUG_TIMING __LINUX__ && GNUNET_NO |
@@ -76,6 +77,12 @@ | |||
76 | #define DEBUG_DHT(...) | 77 | #define DEBUG_DHT(...) |
77 | #endif | 78 | #endif |
78 | 79 | ||
80 | #if MESH_DEBUG_REGEX | ||
81 | #define DEBUG_REGEX(...) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) | ||
82 | #else | ||
83 | #define DEBUG_REGEX(...) | ||
84 | #endif | ||
85 | |||
79 | #if MESH_DEBUG_TIMING | 86 | #if MESH_DEBUG_TIMING |
80 | #include <time.h> | 87 | #include <time.h> |
81 | double __sum; | 88 | double __sum; |
@@ -1255,6 +1262,7 @@ queue_send (void *cls, size_t size, void *buf); | |||
1255 | static void | 1262 | static void |
1256 | regex_cancel_search (struct MeshRegexSearchInfo *regex_search) | 1263 | regex_cancel_search (struct MeshRegexSearchInfo *regex_search) |
1257 | { | 1264 | { |
1265 | DEBUG_REGEX ("Search for %s canelled.\n", regex_search->description); | ||
1258 | GNUNET_REGEX_search_cancel (regex_search->search_handle); | 1266 | GNUNET_REGEX_search_cancel (regex_search->search_handle); |
1259 | if (0 < regex_search->n_peers) | 1267 | if (0 < regex_search->n_peers) |
1260 | GNUNET_free (regex_search->peers); | 1268 | GNUNET_free (regex_search->peers); |
@@ -1282,16 +1290,16 @@ regex_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1282 | GNUNET_PEER_Id id; | 1290 | GNUNET_PEER_Id id; |
1283 | GNUNET_PEER_Id old; | 1291 | GNUNET_PEER_Id old; |
1284 | 1292 | ||
1285 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Regex connect timeout\n"); | 1293 | DEBUG_REGEX ("Regex connect timeout\n"); |
1286 | info->timeout = GNUNET_SCHEDULER_NO_TASK; | 1294 | info->timeout = GNUNET_SCHEDULER_NO_TASK; |
1287 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1295 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1288 | { | 1296 | { |
1289 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " due to shutdown\n"); | 1297 | DEBUG_REGEX (" due to shutdown\n"); |
1290 | return; | 1298 | return; |
1291 | } | 1299 | } |
1292 | 1300 | ||
1293 | old = info->peer; | 1301 | old = info->peer; |
1294 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " timed out: %u\n", old); | 1302 | DEBUG_REGEX (" timed out: %u\n", old); |
1295 | 1303 | ||
1296 | if (0 < info->n_peers) | 1304 | if (0 < info->n_peers) |
1297 | { | 1305 | { |
@@ -1305,7 +1313,7 @@ regex_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1305 | // Try to connect to same peer again. | 1313 | // Try to connect to same peer again. |
1306 | id = info->peer; | 1314 | id = info->peer; |
1307 | } | 1315 | } |
1308 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " trying: %u\n", id); | 1316 | DEBUG_REGEX (" trying: %u\n", id); |
1309 | 1317 | ||
1310 | peer_info = peer_info_get_short(id); | 1318 | peer_info = peer_info_get_short(id); |
1311 | tunnel_add_peer (info->t, peer_info); | 1319 | tunnel_add_peer (info->t, peer_info); |
@@ -1315,7 +1323,7 @@ regex_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1315 | info->timeout = GNUNET_SCHEDULER_add_delayed (connect_timeout, | 1323 | info->timeout = GNUNET_SCHEDULER_add_delayed (connect_timeout, |
1316 | ®ex_connect_timeout, | 1324 | ®ex_connect_timeout, |
1317 | info); | 1325 | info); |
1318 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Regex connect timeout END\n"); | 1326 | DEBUG_REGEX ("Regex connect timeout END\n"); |
1319 | } | 1327 | } |
1320 | 1328 | ||
1321 | 1329 | ||
@@ -1342,8 +1350,8 @@ regex_found_handler (void *cls, | |||
1342 | struct MeshPeerPath *p; | 1350 | struct MeshPeerPath *p; |
1343 | struct MeshPeerInfo *peer_info; | 1351 | struct MeshPeerInfo *peer_info; |
1344 | 1352 | ||
1345 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got regex results from DHT!\n"); | 1353 | DEBUG_REGEX ("Got regex results from DHT!\n"); |
1346 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " for %s\n", info->description); | 1354 | DEBUG_REGEX (" for %s\n", info->description); |
1347 | 1355 | ||
1348 | peer_info = peer_info_get (id); | 1356 | peer_info = peer_info_get (id); |
1349 | p = path_build_from_dht (get_path, get_path_length, | 1357 | p = path_build_from_dht (get_path, get_path_length, |
@@ -1381,10 +1389,10 @@ regex_found_handler (void *cls, | |||
1381 | static void | 1389 | static void |
1382 | regex_put (struct MeshRegexDescriptor *regex) | 1390 | regex_put (struct MeshRegexDescriptor *regex) |
1383 | { | 1391 | { |
1384 | DEBUG_DHT (" regex_put (%s) start\n", regex->regex); | 1392 | DEBUG_REGEX (" regex_put (%s) start\n", regex->regex); |
1385 | if (NULL == regex->h) | 1393 | if (NULL == regex->h) |
1386 | { | 1394 | { |
1387 | DEBUG_DHT (" first put, creating DFA\n"); | 1395 | DEBUG_REGEX (" first put, creating DFA\n"); |
1388 | regex->h = GNUNET_REGEX_announce (dht_handle, | 1396 | regex->h = GNUNET_REGEX_announce (dht_handle, |
1389 | &my_full_id, | 1397 | &my_full_id, |
1390 | regex->regex, | 1398 | regex->regex, |
@@ -1393,10 +1401,10 @@ regex_put (struct MeshRegexDescriptor *regex) | |||
1393 | } | 1401 | } |
1394 | else | 1402 | else |
1395 | { | 1403 | { |
1396 | DEBUG_DHT (" not first put, using cached data\n"); | 1404 | DEBUG_REGEX (" not first put, using cached data\n"); |
1397 | GNUNET_REGEX_reannounce (regex->h); | 1405 | GNUNET_REGEX_reannounce (regex->h); |
1398 | } | 1406 | } |
1399 | DEBUG_DHT (" regex_put (%s) end\n", regex->regex); | 1407 | DEBUG_REGEX (" regex_put (%s) end\n", regex->regex); |
1400 | } | 1408 | } |
1401 | 1409 | ||
1402 | 1410 | ||
@@ -1416,13 +1424,13 @@ regex_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1416 | c->regex_announce_task = GNUNET_SCHEDULER_NO_TASK; | 1424 | c->regex_announce_task = GNUNET_SCHEDULER_NO_TASK; |
1417 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1425 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1418 | return; | 1426 | return; |
1419 | DEBUG_DHT ("Starting PUT for regex\n"); | 1427 | DEBUG_REGEX ("Starting announce for regex\n"); |
1420 | for (i = 0; i < c->n_regex; i++) | 1428 | for (i = 0; i < c->n_regex; i++) |
1421 | regex_put (&c->regexes[i]); | 1429 | regex_put (&c->regexes[i]); |
1422 | c->regex_announce_task = GNUNET_SCHEDULER_add_delayed (app_announce_time, | 1430 | c->regex_announce_task = GNUNET_SCHEDULER_add_delayed (app_announce_time, |
1423 | ®ex_announce, | 1431 | ®ex_announce, |
1424 | cls); | 1432 | cls); |
1425 | DEBUG_DHT ("Finished PUT for regex\n"); | 1433 | DEBUG_REGEX ("Finished announce for regex\n"); |
1426 | } | 1434 | } |
1427 | 1435 | ||
1428 | 1436 | ||
@@ -6524,16 +6532,16 @@ handle_local_announce_regex (void *cls, struct GNUNET_SERVER_Client *client, | |||
6524 | rd.h = NULL; | 6532 | rd.h = NULL; |
6525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " length %u\n", len); | 6533 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " length %u\n", len); |
6526 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regex %s\n", regex); | 6534 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " regex %s\n", regex); |
6527 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " cm %u\n", ntohs(rd.compression)); | 6535 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " compr %u\n", ntohs (rd.compression)); |
6528 | GNUNET_array_append (c->regexes, c->n_regex, rd); | 6536 | GNUNET_array_append (c->regexes, c->n_regex, rd); |
6529 | c->partial_regex = NULL; | 6537 | c->partial_regex = NULL; |
6530 | if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task) | 6538 | if (GNUNET_SCHEDULER_NO_TASK == c->regex_announce_task) |
6531 | { | 6539 | { |
6532 | c->regex_announce_task = GNUNET_SCHEDULER_add_now(®ex_announce, c); | 6540 | c->regex_announce_task = GNUNET_SCHEDULER_add_now (®ex_announce, c); |
6533 | } | 6541 | } |
6534 | else | 6542 | else |
6535 | { | 6543 | { |
6536 | regex_put(&rd); | 6544 | regex_put (&rd); |
6537 | } | 6545 | } |
6538 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 6546 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
6539 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "announce regex processed\n"); | 6547 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "announce regex processed\n"); |