aboutsummaryrefslogtreecommitdiff
path: root/src/nse/gnunet-service-nse.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
commit9fac6b6eefdc9144053f736fd388cb2199a97046 (patch)
tree82740a981b7f6ae973d915aa77797acd9db668b2 /src/nse/gnunet-service-nse.c
parent23d8d343d5c70481ecf78ec4fafc698907f3e8a9 (diff)
downloadgnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.tar.gz
gnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.zip
-removing legacy ifdefs, fixing log statements
Diffstat (limited to 'src/nse/gnunet-service-nse.c')
-rw-r--r--src/nse/gnunet-service-nse.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 8aff436cb..8373b621c 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -410,9 +410,7 @@ handle_start_message (void *cls, struct GNUNET_SERVER_Client *client,
410{ 410{
411 struct GNUNET_NSE_ClientMessage em; 411 struct GNUNET_NSE_ClientMessage em;
412 412
413#if DEBUG_NSE
414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); 413 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n");
415#endif
416 GNUNET_SERVER_notification_context_add (nc, client); 414 GNUNET_SERVER_notification_context_add (nc, client);
417 setup_estimate_message (&em); 415 setup_estimate_message (&em);
418 GNUNET_SERVER_notification_context_unicast (nc, client, &em.header, 416 GNUNET_SERVER_notification_context_unicast (nc, client, &em.header,
@@ -457,11 +455,9 @@ get_delay_randomization (uint32_t matching_bits)
457 455
458 d = get_matching_bits_delay (matching_bits); 456 d = get_matching_bits_delay (matching_bits);
459 i = (uint32_t) (d / (double) (hop_count_max + 1)); 457 i = (uint32_t) (d / (double) (hop_count_max + 1));
460#if DEBUG_NSE
461 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 458 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
462 "Randomizing flood using latencies up to %u ms\n", 459 "Randomizing flood using latencies up to %u ms\n",
463 (unsigned int) i); 460 (unsigned int) i);
464#endif
465 ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, i + 1); 461 ret.rel_value = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, i + 1);
466 return ret; 462 return ret;
467#else 463#else
@@ -514,11 +510,9 @@ get_transmit_delay (int round_offset)
514#else 510#else
515 ret = GNUNET_TIME_UNIT_ZERO; 511 ret = GNUNET_TIME_UNIT_ZERO;
516#endif 512#endif
517#if DEBUG_NSE
518 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 513 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
519 "Transmitting previous round behind schedule in %llu ms\n", 514 "Transmitting previous round behind schedule in %llu ms\n",
520 (unsigned long long) ret.rel_value); 515 (unsigned long long) ret.rel_value);
521#endif
522 return ret; 516 return ret;
523 case 0: 517 case 0:
524 /* current round is based on best-known matching_bits */ 518 /* current round is based on best-known matching_bits */
@@ -527,13 +521,11 @@ get_transmit_delay (int round_offset)
527 dist_delay = get_matching_bits_delay (matching_bits); 521 dist_delay = get_matching_bits_delay (matching_bits);
528 dist_delay += get_delay_randomization (matching_bits).rel_value; 522 dist_delay += get_delay_randomization (matching_bits).rel_value;
529 ret.rel_value = (uint64_t) dist_delay; 523 ret.rel_value = (uint64_t) dist_delay;
530#if DEBUG_NSE
531 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 524 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
532 "For round %llu, delay for %u matching bits is %llu ms\n", 525 "For round %llu, delay for %u matching bits is %llu ms\n",
533 (unsigned long long) current_timestamp.abs_value, 526 (unsigned long long) current_timestamp.abs_value,
534 (unsigned int) matching_bits, 527 (unsigned int) matching_bits,
535 (unsigned long long) ret.rel_value); 528 (unsigned long long) ret.rel_value);
536#endif
537 /* now consider round start time and add delay to it */ 529 /* now consider round start time and add delay to it */
538 tgt = GNUNET_TIME_absolute_add (current_timestamp, ret); 530 tgt = GNUNET_TIME_absolute_add (current_timestamp, ret);
539 return GNUNET_TIME_absolute_get_remaining (tgt); 531 return GNUNET_TIME_absolute_get_remaining (tgt);
@@ -599,7 +591,6 @@ transmit_ready (void *cls, size_t size, void *buf)
599 1, GNUNET_NO); 591 1, GNUNET_NO);
600 return 0; 592 return 0;
601 } 593 }
602#if DEBUG_NSE
603 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 594 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
604 "In round %llu, sending to `%s' estimate with %u bits\n", 595 "In round %llu, sending to `%s' estimate with %u bits\n",
605 (unsigned long long) 596 (unsigned long long)
@@ -607,7 +598,6 @@ transmit_ready (void *cls, size_t size, void *buf)
607 timestamp).abs_value, 598 timestamp).abs_value,
608 GNUNET_i2s (&peer_entry->id), 599 GNUNET_i2s (&peer_entry->id),
609 (unsigned int) ntohl (size_estimate_messages[idx].matching_bits)); 600 (unsigned int) ntohl (size_estimate_messages[idx].matching_bits));
610#endif
611 if (ntohl (size_estimate_messages[idx].hop_count) == 0) 601 if (ntohl (size_estimate_messages[idx].hop_count) == 0)
612 GNUNET_STATISTICS_update (stats, "# flood messages started", 1, GNUNET_NO); 602 GNUNET_STATISTICS_update (stats, "# flood messages started", 1, GNUNET_NO);
613 GNUNET_STATISTICS_update (stats, "# flood messages transmitted", 1, 603 GNUNET_STATISTICS_update (stats, "# flood messages transmitted", 1,
@@ -887,10 +877,8 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
887 if (nse_work_required <= count_leading_zeroes (&result)) 877 if (nse_work_required <= count_leading_zeroes (&result))
888 { 878 {
889 my_proof = counter; 879 my_proof = counter;
890#if DEBUG_NSE
891 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work found: %llu!\n", 880 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work found: %llu!\n",
892 (unsigned long long) GNUNET_ntohll (counter)); 881 (unsigned long long) GNUNET_ntohll (counter));
893#endif
894 write_proof (); 882 write_proof ();
895 setup_flood_message (estimate_index, current_timestamp); 883 setup_flood_message (estimate_index, current_timestamp);
896 return; 884 return;
@@ -900,10 +888,8 @@ find_proof (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
900 } 888 }
901 if (my_proof / (100 * ROUND_SIZE) < counter / (100 * ROUND_SIZE)) 889 if (my_proof / (100 * ROUND_SIZE) < counter / (100 * ROUND_SIZE))
902 { 890 {
903#if DEBUG_NSE
904 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing proofs currently at %llu\n", 891 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing proofs currently at %llu\n",
905 (unsigned long long) counter); 892 (unsigned long long) counter);
906#endif
907 /* remember progress every 100 rounds */ 893 /* remember progress every 100 rounds */
908 my_proof = counter; 894 my_proof = counter;
909 write_proof (); 895 write_proof ();
@@ -1207,10 +1193,8 @@ handle_core_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
1207{ 1193{
1208 struct NSEPeerEntry *peer_entry; 1194 struct NSEPeerEntry *peer_entry;
1209 1195
1210#if DEBUG_NSE
1211 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' connected to us\n", 1196 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' connected to us\n",
1212 GNUNET_i2s (peer)); 1197 GNUNET_i2s (peer));
1213#endif
1214 peer_entry = GNUNET_malloc (sizeof (struct NSEPeerEntry)); 1198 peer_entry = GNUNET_malloc (sizeof (struct NSEPeerEntry));
1215 peer_entry->id = *peer; 1199 peer_entry->id = *peer;
1216 GNUNET_assert (GNUNET_OK == 1200 GNUNET_assert (GNUNET_OK ==
@@ -1236,10 +1220,8 @@ handle_core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
1236{ 1220{
1237 struct NSEPeerEntry *pos; 1221 struct NSEPeerEntry *pos;
1238 1222
1239#if DEBUG_NSE
1240 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' disconnected from us\n", 1223 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' disconnected from us\n",
1241 GNUNET_i2s (peer)); 1224 GNUNET_i2s (peer));
1242#endif
1243 pos = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey); 1225 pos = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
1244 if (NULL == pos) 1226 if (NULL == pos)
1245 { 1227 {