aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 @@
36#include "gnunet_util_lib.h" 36#include "gnunet_util_lib.h"
37 37
38#ifdef __cplusplus 38#ifdef __cplusplus
39extern "C" 39extern "C" {
40{ 40#if 0 /* keep Emacsens' auto-indent happy */
41#if 0 /* keep Emacsens' auto-indent happy */
42} 41}
43#endif 42#endif
44#endif 43#endif
@@ -54,6 +53,12 @@ extern "C"
54 */ 53 */
55#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello" 54#define GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY "transport-peer-hello"
56 55
56/**
57 * Key used to store sender's monotonic time from backchannel
58 * messages.
59 */
60#define GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME \
61 "transport-backchannel-monotonic-time"
57 62
58/** 63/**
59 * Options for storing values in PEERSTORE 64 * Options for storing values in PEERSTORE
@@ -134,9 +139,7 @@ struct GNUNET_PEERSTORE_Record
134 * @param cls closure 139 * @param cls closure
135 * @param success #GNUNET_OK or #GNUNET_SYSERR 140 * @param success #GNUNET_OK or #GNUNET_SYSERR
136 */ 141 */
137typedef void 142typedef void (*GNUNET_PEERSTORE_Continuation) (void *cls, int success);
138(*GNUNET_PEERSTORE_Continuation)(void *cls,
139 int success);
140 143
141 144
142/** 145/**
@@ -146,10 +149,10 @@ typedef void
146 * @param record peerstore record information 149 * @param record peerstore record information
147 * @param emsg error message, or NULL if no errors 150 * @param emsg error message, or NULL if no errors
148 */ 151 */
149typedef void 152typedef void (*GNUNET_PEERSTORE_Processor) (
150(*GNUNET_PEERSTORE_Processor) (void *cls, 153 void *cls,
151 const struct GNUNET_PEERSTORE_Record *record, 154 const struct GNUNET_PEERSTORE_Record *record,
152 const char *emsg); 155 const char *emsg);
153 156
154 157
155/** 158/**
@@ -170,8 +173,7 @@ GNUNET_PEERSTORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
170 * @param sync_first send any pending STORE requests before disconnecting 173 * @param sync_first send any pending STORE requests before disconnecting
171 */ 174 */
172void 175void
173GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, 176GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h, int sync_first);
174 int sync_first);
175 177
176 178
177/** 179/**
@@ -271,7 +273,7 @@ void
271GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc); 273GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc);
272 274
273 275
274#if 0 /* keep Emacsens' auto-indent happy */ 276#if 0 /* keep Emacsens' auto-indent happy */
275{ 277{
276#endif 278#endif
277#ifdef __cplusplus 279#ifdef __cplusplus
@@ -280,4 +282,4 @@ GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc);
280 282
281#endif 283#endif
282 284
283/** @} */ /* end of group */ 285/** @} */ /* 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 @@
28 * - proper use/initialization of timestamps in messages exchanged 28 * - proper use/initialization of timestamps in messages exchanged
29 * during DV learning 29 * during DV learning
30 * - persistence of monotonic time obtained from other peers 30 * - persistence of monotonic time obtained from other peers
31 * in PEERSTORE (by message type) 31 * in PEERSTORE (by message type) -- done for backchannel, needed elsewhere?
32 * - change transport-core API to provide proper flow control in both 32 * - change transport-core API to provide proper flow control in both
33 * directions, allow multiple messages per peer simultaneously (tag 33 * directions, allow multiple messages per peer simultaneously (tag
34 * confirmations with unique message ID), and replace quota-out with 34 * confirmations with unique message ID), and replace quota-out with
@@ -4874,16 +4874,17 @@ update_backtalker_monotime (struct Backtalker *b)
4874 b->task = NULL; 4874 b->task = NULL;
4875 } 4875 }
4876 mtbe = GNUNET_TIME_absolute_hton (b->monotonic_time); 4876 mtbe = GNUNET_TIME_absolute_hton (b->monotonic_time);
4877 b->sc = GNUNET_PEERSTORE_store (peerstore, 4877 b->sc =
4878 "transport", 4878 GNUNET_PEERSTORE_store (peerstore,
4879 &b->pid, 4879 "transport",
4880 "transport-backchannel-monotonic-time", 4880 &b->pid,
4881 &mtbe, 4881 GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME,
4882 sizeof (mtbe), 4882 &mtbe,
4883 GNUNET_TIME_UNIT_FOREVER_ABS, 4883 sizeof (mtbe),
4884 GNUNET_PEERSTORE_STOREOPTION_REPLACE, 4884 GNUNET_TIME_UNIT_FOREVER_ABS,
4885 &backtalker_monotime_store_cb, 4885 GNUNET_PEERSTORE_STOREOPTION_REPLACE,
4886 b); 4886 &backtalker_monotime_store_cb,
4887 b);
4887} 4888}
4888 4889
4889 4890
@@ -5003,12 +5004,13 @@ handle_backchannel_encapsulation (
5003 b->timeout = 5004 b->timeout =
5004 GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT); 5005 GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT);
5005 b->task = GNUNET_SCHEDULER_add_at (b->timeout, &backtalker_timeout_cb, b); 5006 b->task = GNUNET_SCHEDULER_add_at (b->timeout, &backtalker_timeout_cb, b);
5006 b->get = GNUNET_PEERSTORE_iterate (peerstore, 5007 b->get =
5007 "transport", 5008 GNUNET_PEERSTORE_iterate (peerstore,
5008 &b->pid, 5009 "transport",
5009 "transport-backchannel-monotonic-time", 5010 &b->pid,
5010 &backtalker_monotime_cb, 5011 GNUNET_PEERSTORE_TRANSPORT_BACKCHANNEL_MONOTIME,
5011 b); 5012 &backtalker_monotime_cb,
5013 b);
5012 } 5014 }
5013} 5015}
5014 5016