aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-15 18:46:17 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-15 18:46:17 +0100
commit5b32752cd7b02adcb8e6fec7798637638c6f63a0 (patch)
tree2756224d5fff5c1427ab08454c2ee29a0f620c4e /src/dht
parent16fd15965ca4a9a2986f60a7301e86ecb06eb6e3 (diff)
downloadgnunet-5b32752cd7b02adcb8e6fec7798637638c6f63a0.tar.gz
gnunet-5b32752cd7b02adcb8e6fec7798637638c6f63a0.zip
indentation fixes
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-service-dht_hello.c20
-rw-r--r--src/dht/gnunet-service-dht_routing.c36
2 files changed, 38 insertions, 18 deletions
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c
index 3716ea3af..5a5c41567 100644
--- a/src/dht/gnunet-service-dht_hello.c
+++ b/src/dht/gnunet-service-dht_hello.c
@@ -69,13 +69,15 @@ GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
69 * FIXME this is called once per address. Merge instead of replacing? 69 * FIXME this is called once per address. Merge instead of replacing?
70 */ 70 */
71static void 71static void
72process_hello (void *cls, const struct GNUNET_PeerIdentity *peer, 72process_hello (void *cls,
73 const struct GNUNET_HELLO_Message *hello, const char *err_msg) 73 const struct GNUNET_PeerIdentity *peer,
74 const struct GNUNET_HELLO_Message *hello,
75 const char *err_msg)
74{ 76{
75 struct GNUNET_TIME_Absolute ex; 77 struct GNUNET_TIME_Absolute ex;
76 struct GNUNET_HELLO_Message *hm; 78 struct GNUNET_HELLO_Message *hm;
77 79
78 if (hello == NULL) 80 if (NULL == hello)
79 return; 81 return;
80 ex = GNUNET_HELLO_get_last_expiration (hello); 82 ex = GNUNET_HELLO_get_last_expiration (hello);
81 if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us) 83 if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us)
@@ -100,8 +102,12 @@ process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
100void 102void
101GDS_HELLO_init () 103GDS_HELLO_init ()
102{ 104{
103 pnc = GNUNET_PEERINFO_notify (GDS_cfg, GNUNET_NO, &process_hello, NULL); 105 pnc = GNUNET_PEERINFO_notify (GDS_cfg,
104 peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO); 106 GNUNET_NO,
107 &process_hello,
108 NULL);
109 peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256,
110 GNUNET_NO);
105} 111}
106 112
107 113
@@ -131,7 +137,9 @@ GDS_HELLO_done ()
131 } 137 }
132 if (NULL != peer_to_hello) 138 if (NULL != peer_to_hello)
133 { 139 {
134 GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, &free_hello, NULL); 140 GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello,
141 &free_hello,
142 NULL);
135 GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello); 143 GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello);
136 } 144 }
137} 145}
diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c
index 38e5fc1c7..978c46d73 100644
--- a/src/dht/gnunet-service-dht_routing.c
+++ b/src/dht/gnunet-service-dht_routing.c
@@ -160,7 +160,9 @@ struct ProcessContext
160 * #GNUNET_SYSERR if the result is malformed or type unsupported 160 * #GNUNET_SYSERR if the result is malformed or type unsupported
161 */ 161 */
162static int 162static int
163process (void *cls, const struct GNUNET_HashCode * key, void *value) 163process (void *cls,
164 const struct GNUNET_HashCode *key,
165 void *value)
164{ 166{
165 struct ProcessContext *pc = cls; 167 struct ProcessContext *pc = cls;
166 struct RecentRequest *rr = value; 168 struct RecentRequest *rr = value;
@@ -170,7 +172,8 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value)
170 struct GNUNET_HashCode hc; 172 struct GNUNET_HashCode hc;
171 const struct GNUNET_HashCode *eval_key; 173 const struct GNUNET_HashCode *eval_key;
172 174
173 if ((rr->type != GNUNET_BLOCK_TYPE_ANY) && (rr->type != pc->type)) 175 if ( (rr->type != GNUNET_BLOCK_TYPE_ANY) &&
176 (rr->type != pc->type) )
174 return GNUNET_OK; /* type missmatch */ 177 return GNUNET_OK; /* type missmatch */
175 178
176 if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE)) 179 if (0 != (rr->options & GNUNET_DHT_RO_RECORD_ROUTE))
@@ -192,7 +195,8 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value)
192 * we fake it by changing the key to the actual PID ... */ 195 * we fake it by changing the key to the actual PID ... */
193 GNUNET_BLOCK_get_key (GDS_block_context, 196 GNUNET_BLOCK_get_key (GDS_block_context,
194 GNUNET_BLOCK_TYPE_DHT_HELLO, 197 GNUNET_BLOCK_TYPE_DHT_HELLO,
195 pc->data, pc->data_size, 198 pc->data,
199 pc->data_size,
196 &hc); 200 &hc);
197 eval_key = &hc; 201 eval_key = &hc;
198 } 202 }
@@ -200,8 +204,8 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value)
200 { 204 {
201 eval_key = key; 205 eval_key = key;
202 } 206 }
203 eval = 207 eval
204 GNUNET_BLOCK_evaluate (GDS_block_context, 208 = GNUNET_BLOCK_evaluate (GDS_block_context,
205 pc->type, 209 pc->type,
206 GNUNET_BLOCK_EO_NONE, 210 GNUNET_BLOCK_EO_NONE,
207 eval_key, 211 eval_key,
@@ -310,7 +314,10 @@ GDS_ROUTING_process (void *cls,
310 pc.data_size = 0; 314 pc.data_size = 0;
311 pc.data = ""; /* something not null */ 315 pc.data = ""; /* something not null */
312 } 316 }
313 GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, key, &process, &pc); 317 GNUNET_CONTAINER_multihashmap_get_multiple (recent_map,
318 key,
319 &process,
320 &pc);
314} 321}
315 322
316 323
@@ -347,11 +354,13 @@ expire_oldest_entry ()
347 * @param cls the new 'struct RecentRequest' (to discard upon successful combination) 354 * @param cls the new 'struct RecentRequest' (to discard upon successful combination)
348 * @param key the query 355 * @param key the query
349 * @param value the existing 'struct RecentRequest' (to update upon successful combination) 356 * @param value the existing 'struct RecentRequest' (to update upon successful combination)
350 * @return GNUNET_OK (continue to iterate), 357 * @return #GNUNET_OK (continue to iterate),
351 * GNUNET_SYSERR if the request was successfully combined 358 * #GNUNET_SYSERR if the request was successfully combined
352 */ 359 */
353static int 360static int
354try_combine_recent (void *cls, const struct GNUNET_HashCode * key, void *value) 361try_combine_recent (void *cls,
362 const struct GNUNET_HashCode *key,
363 void *value)
355{ 364{
356 struct RecentRequest *in = cls; 365 struct RecentRequest *in = cls;
357 struct RecentRequest *rr = value; 366 struct RecentRequest *rr = value;
@@ -398,7 +407,8 @@ void
398GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender, 407GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
399 enum GNUNET_BLOCK_Type type, 408 enum GNUNET_BLOCK_Type type,
400 enum GNUNET_DHT_RouteOption options, 409 enum GNUNET_DHT_RouteOption options,
401 const struct GNUNET_HashCode * key, const void *xquery, 410 const struct GNUNET_HashCode *key,
411 const void *xquery,
402 size_t xquery_size, 412 size_t xquery_size,
403 const struct GNUNET_CONTAINER_BloomFilter *reply_bf, 413 const struct GNUNET_CONTAINER_BloomFilter *reply_bf,
404 uint32_t reply_bf_mutator) 414 uint32_t reply_bf_mutator)
@@ -421,8 +431,10 @@ GDS_ROUTING_add (const struct GNUNET_PeerIdentity *sender,
421 recent_req->xquery_size = xquery_size; 431 recent_req->xquery_size = xquery_size;
422 recent_req->reply_bf_mutator = reply_bf_mutator; 432 recent_req->reply_bf_mutator = reply_bf_mutator;
423 if (GNUNET_SYSERR == 433 if (GNUNET_SYSERR ==
424 GNUNET_CONTAINER_multihashmap_get_multiple (recent_map, key, 434 GNUNET_CONTAINER_multihashmap_get_multiple (recent_map,
425 &try_combine_recent, recent_req)) 435 key,
436 &try_combine_recent,
437 recent_req))
426 { 438 {
427 GNUNET_STATISTICS_update (GDS_stats, 439 GNUNET_STATISTICS_update (GDS_stats,
428 gettext_noop 440 gettext_noop