[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18364 - gnunet/src/nse
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18364 - gnunet/src/nse |
Date: |
Mon, 28 Nov 2011 19:02:29 +0100 |
Author: grothoff
Date: 2011-11-28 19:02:29 +0100 (Mon, 28 Nov 2011)
New Revision: 18364
Modified:
gnunet/src/nse/gnunet-service-nse.c
Log:
-trying harder to remove useless signing in NSE
Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2011-11-28 17:51:36 UTC (rev 18363)
+++ gnunet/src/nse/gnunet-service-nse.c 2011-11-28 18:02:29 UTC (rev 18364)
@@ -830,7 +830,6 @@
sizeof (uint64_t)];
GNUNET_HashCode result;
unsigned int i;
- const struct GNUNET_CRYPTO_RsaSignature *sig_cache;
proof_task = GNUNET_SCHEDULER_NO_TASK;
memcpy (&buf[sizeof (uint64_t)], &my_public_key,
@@ -848,36 +847,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Proof of work found: %llu!\n",
(unsigned long long) GNUNET_ntohll (counter));
#endif
- sig_cache = NULL;
- for (i = 0; i < HISTORY_SIZE; i++)
- if (ntohl (size_estimate_messages[i].hop_count) == 0)
- {
- size_estimate_messages[i].proof_of_work = my_proof;
- if (nse_work_required > 0)
- {
- if (sig_cache == NULL)
- {
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CRYPTO_rsa_sign (my_private_key,
- &size_estimate_messages
- [i].purpose,
- &size_estimate_messages
- [i].signature));
- sig_cache = &size_estimate_messages[i].signature;
- }
- else
- {
- /* use cached signature */
- size_estimate_messages[i].signature = *sig_cache;
- }
- }
- else
- {
- /* no signature required */
- memset (&size_estimate_messages[i].signature, 0, sizeof (struct
GNUNET_CRYPTO_RsaSignature));
- }
- }
write_proof ();
+ setup_flood_message (estimate_index, current_timestamp);
return;
}
counter++;
@@ -1270,7 +1241,6 @@
{
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute prev_time;
- unsigned int i;
if (server == NULL)
{
@@ -1288,17 +1258,17 @@
(now.abs_value / gnunet_nse_interval.rel_value) *
gnunet_nse_interval.rel_value;
next_timestamp.abs_value =
- current_timestamp.abs_value + gnunet_nse_interval.rel_value;
-
- for (i = 0; i < HISTORY_SIZE; i++)
+ current_timestamp.abs_value + gnunet_nse_interval.rel_value;
+ estimate_index = HISTORY_SIZE - 1;
+ estimate_count = 0;
+ if (GNUNET_YES == check_proof_of_work (&my_public_key,
+ my_proof))
{
prev_time.abs_value =
- current_timestamp.abs_value - (HISTORY_SIZE - i -
- 1) * gnunet_nse_interval.rel_value;
- setup_flood_message (i, prev_time);
+ current_timestamp.abs_value - (estimate_index - 1) *
gnunet_nse_interval.rel_value;
+ setup_flood_message (estimate_index, prev_time);
+ estimate_count++;
}
- estimate_index = HISTORY_SIZE - 1;
- estimate_count = 2;
flood_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
(next_timestamp), &update_flood_message,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18364 - gnunet/src/nse,
gnunet <=