summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-04-21 14:54:04 +0200
committerChristian Grothoff <christian@grothoff.org>2019-04-21 14:54:04 +0200
commit1c24355745a810d20b9fd7545631be6300d0b71c (patch)
tree11769eba5e038d1970a5f085f08ea4b2a7d4e15a
parentfe3cc0e1a6f83c6ba4e0e1ec1185f1173ff16570 (diff)
define constant
-rw-r--r--src/include/gnunet_peerstore_service.h30
-rw-r--r--src/transport/gnunet-service-tng.c36
2 files changed, 35 insertions, 31 deletions
diff --git a/src/include/gnunet_peerstore_service.h b/src/include/gnunet_peerstore_service.h
index d9acf0576..b20c1f3c7 100644
--- a/src/include/gnunet_peerstore_service.h
+++ b/src/include/gnunet_peerstore_service.h
@@ -36,9 +36,8 @@
#include "gnunet_util_lib.h"
#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
@@ -54,6 +53,12 @@ extern "C"
*/
#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello"
+/**
+ * Key used to store sender's monotonic time from backchannel
+ * messages.
+ */
+#define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME \
+ "transport-backchannel-monotonic-time"
/**
* Options for storing values in PEERSTORE
@@ -134,9 +139,7 @@ struct GNUNET_PEERSTORE_Record
* @param cls closure
* @param success #GNUNET_OK or #GNUNET_SYSERR
*/
-typedef void
-(*GNUNET_PEERSTORE_Continuation)(void *cls,
- int success);
+typedef void (*GNUNET_PEERSTORE_Continuation) (void *cls, int success);
/**
@@ -146,10 +149,10 @@ typedef void
* @param record peerstore record information
* @param emsg error message, or NULL if no errors
*/
-typedef void
-(*GNUNET_PEERSTORE_Processor) (void *cls,
- const struct GNUNET_PEERSTORE_Record *record,
- const char *emsg);
+typedef void (*GNUNET_PEERSTORE_Processor) (
+ void *cls,
+ const struct GNUNET_PEERSTORE_Record *record,
+ const char *emsg);
/**
@@ -170,8 +173,7 @@ GNUNET_PEERSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
* @param sync_first send any pending STORE requests before disconnecting
*/
void
-GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h,
- int sync_first);
+GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first);
/**
@@ -271,7 +273,7 @@ void
GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc);
-#if 0 /* keep Emacsens' auto-indent happy */
+#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
@@ -280,4 +282,4 @@ GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc);
#endif
-/** @} */ /* end of group */
+/** @} */ /* end of group */
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 4dc3a137d..7683ed016 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -28,7 +28,7 @@
* - proper use/initialization of timestamps in messages exchanged
* during DV learning
* - persistence of monotonic time obtained from other peers
- * in PEERSTORE (by message type)
+ * in PEERSTORE (by message type) -- done for backchannel, needed elsewhere?
* - change transport-core API to provide proper flow control in both
* directions, allow multiple messages per peer simultaneously (tag
* confirmations with unique message ID), and replace quota-out with
@@ -4874,16 +4874,17 @@ update_backtalker_monotime (struct Backtalker *b)
b->task = NULL;
}
mtbe = GNUNET_TIME_absolute_hton (b->monotonic_time);
- b->sc = GNUNET_PEERSTORE_store (peerstore,
- "transport",
- &b->pid,
- "transport-backchannel-monotonic-time",
- &mtbe,
- sizeof (mtbe),
- GNUNET_TIME_UNIT_FOREVER_ABS,
- GNUNET_PEERSTORE_STOREOPTION_REPLACE,
- &backtalker_monotime_store_cb,
- b);
+ b->sc =
+ GNUNET_PEERSTORE_store (peerstore,
+ "transport",
+ &b->pid,
+ GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME,
+ &mtbe,
+ sizeof (mtbe),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_PEERSTORE_STOREOPTION_REPLACE,
+ &backtalker_monotime_store_cb,
+ b);
}
@@ -5003,12 +5004,13 @@ handle_backchannel_encapsulation (
b->timeout =
GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT);
b->task = GNUNET_SCHEDULER_add_at (b->timeout, &backtalker_timeout_cb, b);
- b->get = GNUNET_PEERSTORE_iterate (peerstore,
- "transport",
- &b->pid,
- "transport-backchannel-monotonic-time",
- &backtalker_monotime_cb,
- b);
+ b->get =
+ GNUNET_PEERSTORE_iterate (peerstore,
+ "transport",
+ &b->pid,
+ GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME,
+ &backtalker_monotime_cb,
+ b);
}
}