aboutsummaryrefslogtreecommitdiff
path: root/src/hello/hello.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hello/hello.c')
-rw-r--r--src/hello/hello.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 9c0c3d4ac..f7d34233c 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -74,8 +74,7 @@ struct GNUNET_HELLO_Message
74 */ 74 */
75size_t 75size_t
76GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address, 76GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
77 struct GNUNET_TIME_Absolute expiration, 77 struct GNUNET_TIME_Absolute expiration, char *target,
78 char *target,
79 size_t max) 78 size_t max)
80{ 79{
81 uint16_t alen; 80 uint16_t alen;
@@ -232,8 +231,8 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
232 wpos = 0; 231 wpos = 0;
233 woff = (ret != NULL) ? (char *) &ret[1] : NULL; 232 woff = (ret != NULL) ? (char *) &ret[1] : NULL;
234 GNUNET_CRYPTO_hash (&msg->publicKey, 233 GNUNET_CRYPTO_hash (&msg->publicKey,
235 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 234 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
236 &address.peer.hashPubKey); 235 &address.peer.hashPubKey);
237 while (insize > 0) 236 while (insize > 0)
238 { 237 {
239 esize = get_hello_address_size (inptr, insize, &alen); 238 esize = get_hello_address_size (inptr, insize, &alen);
@@ -280,14 +279,12 @@ struct ExpireContext
280 279
281 280
282static int 281static int
283get_match_exp (void *cls, 282get_match_exp (void *cls, const struct GNUNET_HELLO_Address *address,
284 const struct GNUNET_HELLO_Address *address,
285 struct GNUNET_TIME_Absolute expiration) 283 struct GNUNET_TIME_Absolute expiration)
286{ 284{
287 struct ExpireContext *ec = cls; 285 struct ExpireContext *ec = cls;
288 286
289 if (0 == GNUNET_HELLO_address_cmp (address, 287 if (0 == GNUNET_HELLO_address_cmp (address, ec->address))
290 ec->address))
291 { 288 {
292 ec->found = GNUNET_YES; 289 ec->found = GNUNET_YES;
293 ec->expiration = expiration; 290 ec->expiration = expiration;
@@ -311,8 +308,7 @@ struct MergeContext
311 308
312 309
313static int 310static int
314copy_latest (void *cls, 311copy_latest (void *cls, const struct GNUNET_HELLO_Address *address,
315 const struct GNUNET_HELLO_Address *address,
316 struct GNUNET_TIME_Absolute expiration) 312 struct GNUNET_TIME_Absolute expiration)
317{ 313{
318 struct MergeContext *mc = cls; 314 struct MergeContext *mc = cls;
@@ -327,9 +323,8 @@ copy_latest (void *cls,
327 (mc->take_equal == GNUNET_YES))) 323 (mc->take_equal == GNUNET_YES)))
328 { 324 {
329 mc->ret += 325 mc->ret +=
330 GNUNET_HELLO_add_address (address, 326 GNUNET_HELLO_add_address (address, expiration, &mc->buf[mc->ret],
331 expiration, 327 mc->max - mc->ret);
332 &mc->buf[mc->ret], mc->max - mc->ret);
333 } 328 }
334 return GNUNET_OK; 329 return GNUNET_OK;
335} 330}
@@ -388,8 +383,7 @@ struct DeltaContext
388 383
389 384
390static int 385static int
391delta_match (void *cls, 386delta_match (void *cls, const struct GNUNET_HELLO_Address *address,
392 const struct GNUNET_HELLO_Address *address,
393 struct GNUNET_TIME_Absolute expiration) 387 struct GNUNET_TIME_Absolute expiration)
394{ 388{
395 struct DeltaContext *dc = cls; 389 struct DeltaContext *dc = cls;
@@ -547,9 +541,7 @@ find_other_matching (void *cls, const struct GNUNET_HELLO_Address *address,
547 541
548 if (expiration.abs_value < ec->expiration_limit.abs_value) 542 if (expiration.abs_value < ec->expiration_limit.abs_value)
549 return GNUNET_YES; 543 return GNUNET_YES;
550 if (0 == 544 if (0 == GNUNET_HELLO_address_cmp (address, ec->address))
551 GNUNET_HELLO_address_cmp (address,
552 ec->address))
553 { 545 {
554 ec->found = GNUNET_YES; 546 ec->found = GNUNET_YES;
555 if (expiration.abs_value < ec->expiration.abs_value) 547 if (expiration.abs_value < ec->expiration.abs_value)