define constant
authorChristian Grothoff <christian@grothoff.org>
Sun, 21 Apr 2019 12:54:04 +0000 (14:54 +0200)
committerChristian Grothoff <christian@grothoff.org>
Sun, 21 Apr 2019 12:54:04 +0000 (14:54 +0200)
src/include/gnunet_peerstore_service.h
src/transport/gnunet-service-tng.c

index d9acf0576022cba42eddbad8540c5ba7d4c27b1f..b20c1f3c77a07ed769d69463a91ddb4169f05175 100644 (file)
@@ -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 */
index 4dc3a137d35d615ac43831ccf3f295aafc5c82b9..7683ed016aa8a9c3cf2839ebdb96c7a4befba8f5 100644 (file)
@@ -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);
   }
 }