diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/fs/gnunet-service-fs_put.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/fs/gnunet-service-fs_put.c')
-rw-r--r-- | src/fs/gnunet-service-fs_put.c | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/src/fs/gnunet-service-fs_put.c b/src/fs/gnunet-service-fs_put.c index e67bf0c04..ec2344b37 100644 --- a/src/fs/gnunet-service-fs_put.c +++ b/src/fs/gnunet-service-fs_put.c | |||
@@ -86,9 +86,9 @@ static struct PutOperator operators[] = { | |||
86 | * @param cls type of blocks to gather | 86 | * @param cls type of blocks to gather |
87 | * @param tc scheduler context (unused) | 87 | * @param tc scheduler context (unused) |
88 | */ | 88 | */ |
89 | static void | 89 | static void gather_dht_put_blocks (void *cls, |
90 | gather_dht_put_blocks (void *cls, | 90 | const struct GNUNET_SCHEDULER_TaskContext |
91 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 91 | *tc); |
92 | 92 | ||
93 | 93 | ||
94 | /** | 94 | /** |
@@ -108,8 +108,9 @@ delay_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
108 | return; | 108 | return; |
109 | if (po->zero_anonymity_count_estimate > 0) | 109 | if (po->zero_anonymity_count_estimate > 0) |
110 | { | 110 | { |
111 | delay = GNUNET_TIME_relative_divide (GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY, | 111 | delay = |
112 | po->zero_anonymity_count_estimate); | 112 | GNUNET_TIME_relative_divide (GNUNET_DHT_DEFAULT_REPUBLISH_FREQUENCY, |
113 | po->zero_anonymity_count_estimate); | ||
113 | delay = GNUNET_TIME_relative_min (delay, MAX_DHT_PUT_FREQ); | 114 | delay = GNUNET_TIME_relative_min (delay, MAX_DHT_PUT_FREQ); |
114 | } | 115 | } |
115 | else | 116 | else |
@@ -118,8 +119,8 @@ delay_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
118 | * (hopefully) appear */ | 119 | * (hopefully) appear */ |
119 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5); | 120 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5); |
120 | } | 121 | } |
121 | po->dht_task = GNUNET_SCHEDULER_add_delayed (delay, | 122 | po->dht_task = |
122 | &gather_dht_put_blocks, po); | 123 | GNUNET_SCHEDULER_add_delayed (delay, &gather_dht_put_blocks, po); |
123 | } | 124 | } |
124 | 125 | ||
125 | 126 | ||
@@ -138,13 +139,9 @@ delay_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
138 | * maybe 0 if no unique identifier is available | 139 | * maybe 0 if no unique identifier is available |
139 | */ | 140 | */ |
140 | static void | 141 | static void |
141 | process_dht_put_content (void *cls, | 142 | process_dht_put_content (void *cls, const GNUNET_HashCode * key, size_t size, |
142 | const GNUNET_HashCode * key, | 143 | const void *data, enum GNUNET_BLOCK_Type type, |
143 | size_t size, | 144 | uint32_t priority, uint32_t anonymity, |
144 | const void *data, | ||
145 | enum GNUNET_BLOCK_Type type, | ||
146 | uint32_t priority, | ||
147 | uint32_t anonymity, | ||
148 | struct GNUNET_TIME_Absolute expiration, uint64_t uid) | 145 | struct GNUNET_TIME_Absolute expiration, uint64_t uid) |
149 | { | 146 | { |
150 | struct PutOperator *po = cls; | 147 | struct PutOperator *po = cls; |
@@ -157,22 +154,16 @@ process_dht_put_content (void *cls, | |||
157 | po->dht_task = GNUNET_SCHEDULER_add_now (&delay_dht_put_blocks, po); | 154 | po->dht_task = GNUNET_SCHEDULER_add_now (&delay_dht_put_blocks, po); |
158 | return; | 155 | return; |
159 | } | 156 | } |
160 | po->zero_anonymity_count_estimate = GNUNET_MAX (po->current_offset, | 157 | po->zero_anonymity_count_estimate = |
161 | po->zero_anonymity_count_estimate); | 158 | GNUNET_MAX (po->current_offset, po->zero_anonymity_count_estimate); |
162 | #if DEBUG_FS | 159 | #if DEBUG_FS |
163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 160 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
164 | "Retrieved block `%s' of type %u for DHT PUT\n", | 161 | "Retrieved block `%s' of type %u for DHT PUT\n", GNUNET_h2s (key), |
165 | GNUNET_h2s (key), type); | 162 | type); |
166 | #endif | 163 | #endif |
167 | GNUNET_DHT_put (GSF_dht, | 164 | GNUNET_DHT_put (GSF_dht, key, DEFAULT_PUT_REPLICATION, GNUNET_DHT_RO_NONE, |
168 | key, | 165 | type, size, data, expiration, GNUNET_TIME_UNIT_FOREVER_REL, |
169 | DEFAULT_PUT_REPLICATION, | 166 | &delay_dht_put_blocks, po); |
170 | GNUNET_DHT_RO_NONE, | ||
171 | type, | ||
172 | size, | ||
173 | data, | ||
174 | expiration, | ||
175 | GNUNET_TIME_UNIT_FOREVER_REL, &delay_dht_put_blocks, po); | ||
176 | } | 167 | } |
177 | 168 | ||
178 | 169 | ||
@@ -190,13 +181,12 @@ gather_dht_put_blocks (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
190 | po->dht_task = GNUNET_SCHEDULER_NO_TASK; | 181 | po->dht_task = GNUNET_SCHEDULER_NO_TASK; |
191 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 182 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
192 | return; | 183 | return; |
193 | po->dht_qe = GNUNET_DATASTORE_get_zero_anonymity (GSF_dsh, | 184 | po->dht_qe = |
194 | po->current_offset++, | 185 | GNUNET_DATASTORE_get_zero_anonymity (GSF_dsh, po->current_offset++, 0, |
195 | 0, UINT_MAX, | 186 | UINT_MAX, |
196 | GNUNET_TIME_UNIT_FOREVER_REL, | 187 | GNUNET_TIME_UNIT_FOREVER_REL, |
197 | po->dht_put_type, | 188 | po->dht_put_type, |
198 | &process_dht_put_content, | 189 | &process_dht_put_content, po); |
199 | po); | ||
200 | if (NULL == po->dht_qe) | 190 | if (NULL == po->dht_qe) |
201 | po->dht_task = GNUNET_SCHEDULER_add_now (&delay_dht_put_blocks, po); | 191 | po->dht_task = GNUNET_SCHEDULER_add_now (&delay_dht_put_blocks, po); |
202 | } | 192 | } |