aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_put.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-03-04 12:41:54 +0000
committerChristian Grothoff <christian@grothoff.org>2011-03-04 12:41:54 +0000
commite44d71c3f344950b0ce773afc9868be495f29af7 (patch)
tree822944371440798ba417ba9f398e081bcc48ba54 /src/fs/gnunet-service-fs_put.c
parent8111b29a93408e1befe322c87b468d6a86a8ae66 (diff)
downloadgnunet-e44d71c3f344950b0ce773afc9868be495f29af7.tar.gz
gnunet-e44d71c3f344950b0ce773afc9868be495f29af7.zip
fixes
Diffstat (limited to 'src/fs/gnunet-service-fs_put.c')
-rw-r--r--src/fs/gnunet-service-fs_put.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c
index 862a795ba..6afeb4faa 100644
--- a/src/fs/gnunet-service-fs_put.c
+++ b/src/fs/gnunet-service-fs_put.c
@@ -24,10 +24,17 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet-service-fs.h"
27#include "gnunet-service-fs_put.h" 28#include "gnunet-service-fs_put.h"
28 29
29 30
30/** 31/**
32 * How often do we at most PUT content into the DHT?
33 */
34#define MAX_DHT_PUT_FREQ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
35
36
37/**
31 * Request to datastore for DHT PUTs (or NULL). 38 * Request to datastore for DHT PUTs (or NULL).
32 */ 39 */
33static struct GNUNET_DATASTORE_QueueEntry *dht_qe; 40static struct GNUNET_DATASTORE_QueueEntry *dht_qe;
@@ -70,7 +77,7 @@ consider_dht_put_gathering (void *cls)
70{ 77{
71 struct GNUNET_TIME_Relative delay; 78 struct GNUNET_TIME_Relative delay;
72 79
73 if (dsh == NULL) 80 if (GSF_dsh == NULL)
74 return; 81 return;
75 if (dht_qe != NULL) 82 if (dht_qe != NULL)
76 return; 83 return;
@@ -96,6 +103,17 @@ consider_dht_put_gathering (void *cls)
96 103
97 104
98/** 105/**
106 * Function called upon completion of the DHT PUT operation.
107 */
108static void
109dht_put_continuation (void *cls,
110 const struct GNUNET_SCHEDULER_TaskContext *tc)
111{
112 GNUNET_DATASTORE_get_next (GSF_dsh, GNUNET_YES);
113}
114
115
116/**
99 * Store content in DHT. 117 * Store content in DHT.
100 * 118 *
101 * @param cls closure 119 * @param cls closure
@@ -151,7 +169,7 @@ process_dht_put_content (void *cls,
151 GNUNET_h2s (key), 169 GNUNET_h2s (key),
152 type); 170 type);
153#endif 171#endif
154 GNUNET_DHT_put (dht_handle, 172 GNUNET_DHT_put (GSF_dht,
155 key, 173 key,
156 DEFAULT_PUT_REPLICATION, 174 DEFAULT_PUT_REPLICATION,
157 GNUNET_DHT_RO_NONE, 175 GNUNET_DHT_RO_NONE,
@@ -176,16 +194,16 @@ gather_dht_put_blocks (void *cls,
176 const struct GNUNET_SCHEDULER_TaskContext *tc) 194 const struct GNUNET_SCHEDULER_TaskContext *tc)
177{ 195{
178 dht_task = GNUNET_SCHEDULER_NO_TASK; 196 dht_task = GNUNET_SCHEDULER_NO_TASK;
179 if (dsh != NULL) 197 if (GSF_dsh == NULL)
180 { 198 return;
181 if (dht_put_type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) 199 if (dht_put_type == GNUNET_BLOCK_TYPE_FS_ONDEMAND)
182 dht_put_type = GNUNET_BLOCK_TYPE_FS_KBLOCK; 200 dht_put_type = GNUNET_BLOCK_TYPE_FS_KBLOCK;
183 dht_qe = GNUNET_DATASTORE_get_zero_anonymity (dsh, 0, UINT_MAX, 201 dht_qe = GNUNET_DATASTORE_get_zero_anonymity (GSF_dsh,
184 GNUNET_TIME_UNIT_FOREVER_REL, 202 0, UINT_MAX,
185 dht_put_type++, 203 GNUNET_TIME_UNIT_FOREVER_REL,
186 &process_dht_put_content, NULL); 204 dht_put_type++,
187 GNUNET_assert (dht_qe != NULL); 205 &process_dht_put_content, NULL);
188 } 206 GNUNET_assert (dht_qe != NULL);
189} 207}
190 208
191 209