[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 01/19: optimize startup sequence for when we execu
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 01/19: optimize startup sequence for when we execute first DHT PUTs |
Date: |
Sun, 22 Jan 2017 15:23:42 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit abda55f7008cee983bda0fe4c78076978feddbf3
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jan 22 11:34:02 2017 +0100
optimize startup sequence for when we execute first DHT PUTs
---
src/cadet/gnunet-service-cadet-new_dht.c | 40 +++++++++++++++++++++++++++---
src/cadet/gnunet-service-cadet-new_dht.h | 7 ++++++
src/cadet/gnunet-service-cadet-new_hello.c | 2 ++
3 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet-new_dht.c
b/src/cadet/gnunet-service-cadet-new_dht.c
index 981553601..849562f23 100644
--- a/src/cadet/gnunet-service-cadet-new_dht.c
+++ b/src/cadet/gnunet-service-cadet-new_dht.c
@@ -34,6 +34,22 @@
#include "gnunet-service-cadet-new_peer.h"
#include "gnunet-service-cadet-new_paths.h"
+/**
+ * How long do we wait before first announcing our presence to the DHT.
+ * Used to wait for our HELLO to be available. Note that we also get
+ * notifications when our HELLO is ready, so this is just the maximum
+ * we wait for the first notification.
+ */
+#define STARTUP_DELAY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 500)
+
+/**
+ * How long do we wait after we get an updated HELLO before publishing?
+ * Allows for the HELLO to be updated again quickly, for example in
+ * case multiple addresses changed and we got a partial update.
+ */
+#define CHANGE_DELAY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 100)
+
+
#define LOG(level, ...) GNUNET_log_from (level,"cadet-dht",__VA_ARGS__)
@@ -195,6 +211,23 @@ announce_id (void *cls)
/**
+ * Function called by the HELLO subsystem whenever OUR hello
+ * changes. Re-triggers the DHT PUT immediately.
+ */
+void
+GCD_hello_update ()
+{
+ if (NULL == announce_id_task)
+ return; /* too early */
+ GNUNET_SCHEDULER_cancel (announce_id_task);
+ announce_id_task
+ = GNUNET_SCHEDULER_add_delayed (CHANGE_DELAY,
+ &announce_id,
+ NULL);
+}
+
+
+/**
* Initialize the DHT subsystem.
*
* @param c Configuration.
@@ -202,8 +235,6 @@ announce_id (void *cls)
void
GCD_init (const struct GNUNET_CONFIGURATION_Handle *c)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "init\n");
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_number (c,
"CADET",
@@ -235,8 +266,9 @@ GCD_init (const struct GNUNET_CONFIGURATION_Handle *c)
64);
GNUNET_break (NULL != dht_handle);
announce_delay = GNUNET_TIME_UNIT_SECONDS;
- announce_id_task = GNUNET_SCHEDULER_add_now (&announce_id,
- NULL);
+ announce_id_task = GNUNET_SCHEDULER_add_delayed (STARTUP_DELAY,
+ &announce_id,
+ NULL);
}
diff --git a/src/cadet/gnunet-service-cadet-new_dht.h
b/src/cadet/gnunet-service-cadet-new_dht.h
index 81f16ae99..5d7ab29a0 100644
--- a/src/cadet/gnunet-service-cadet-new_dht.h
+++ b/src/cadet/gnunet-service-cadet-new_dht.h
@@ -63,6 +63,13 @@ GCD_shutdown (void);
/**
+ * Function called by the HELLO subsystem whenever OUR hello
+ * changes. Re-triggers the DHT PUT immediately.
+ */
+void
+GCD_hello_update (void);
+
+/**
* Search DHT for paths to @a peeR_id
*
* @param peer_id peer to search for
diff --git a/src/cadet/gnunet-service-cadet-new_hello.c
b/src/cadet/gnunet-service-cadet-new_hello.c
index 7c8ba3b25..a24325ada 100644
--- a/src/cadet/gnunet-service-cadet-new_hello.c
+++ b/src/cadet/gnunet-service-cadet-new_hello.c
@@ -34,6 +34,7 @@
#include "gnunet_peerinfo_service.h"
#include "cadet_protocol.h"
#include "gnunet-service-cadet-new.h"
+#include "gnunet-service-cadet-new_dht.h"
#include "gnunet-service-cadet-new_hello.h"
#include "gnunet-service-cadet-new_peer.h"
@@ -80,6 +81,7 @@ got_hello (void *cls,
{
GNUNET_free_non_null (mine);
mine = (struct GNUNET_HELLO_Message *) GNUNET_copy_message
(&hello->header);
+ GCD_hello_update ();
return;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] branch master updated (a225f5848 -> 4c56d5a0f), gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 05/19: only send CHANNEL_DESTROY message if we at least send the CHANNEL_CREATE message, and not if the tunnel never went up in the first place, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 08/19: allow NULL argument for GNUNET_i2s(), gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 03/19: improve logging, log before doing, not after, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 01/19: optimize startup sequence for when we execute first DHT PUTs,
gnunet <=
- [GNUnet-SVN] [gnunet] 11/19: fix buffer size, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 04/19: fix startup interaction between channel and tunnel to not send CHANNEL_OPEN until tunnel is in KEY_OK state, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 18/19: nicer logging, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 10/19: make GCPP_2s also return static string, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 12/19: fix a few off-by-ones, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 02/19: do not run upnpc during tests, produces unnecessary errors if not available, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 16/19: nicer order of LOG statements, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 13/19: properly launch DHT GETs based on need for paths, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 17/19: must delay iteration over paths until later, as we may be right now creating a connection, gnunet, 2017/01/22
- [GNUnet-SVN] [gnunet] 19/19: must not move location of -struct CadetPeerPathEntry- in memory when growing path length as those structs are also referenced from a DLL, gnunet, 2017/01/22