diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-02-14 23:58:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-02-14 23:58:22 +0000 |
commit | c1133577206e196ff90db06693cedc6ba816b20e (patch) | |
tree | 55f81baef93e40ff334af4c9e5c660bb79971b5c /src/hello/hello.c | |
parent | 56c6242f0937451f47ae03f91b3bc6adc599592d (diff) | |
download | gnunet-c1133577206e196ff90db06693cedc6ba816b20e.tar.gz gnunet-c1133577206e196ff90db06693cedc6ba816b20e.zip |
also match tname
Diffstat (limited to 'src/hello/hello.c')
-rw-r--r-- | src/hello/hello.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/hello/hello.c b/src/hello/hello.c index 2a99234db..e37ae10e6 100644 --- a/src/hello/hello.c +++ b/src/hello/hello.c | |||
@@ -274,6 +274,7 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg, | |||
274 | struct ExpireContext | 274 | struct ExpireContext |
275 | { | 275 | { |
276 | const void *addr; | 276 | const void *addr; |
277 | const char *tname; | ||
277 | size_t addrlen; | 278 | size_t addrlen; |
278 | int found; | 279 | int found; |
279 | struct GNUNET_TIME_Absolute expiration; | 280 | struct GNUNET_TIME_Absolute expiration; |
@@ -288,7 +289,9 @@ get_match_exp (void *cls, | |||
288 | { | 289 | { |
289 | struct ExpireContext *ec = cls; | 290 | struct ExpireContext *ec = cls; |
290 | 291 | ||
291 | if ((addrlen == ec->addrlen) && (0 == memcmp (addr, ec->addr, addrlen))) | 292 | if ( (addrlen == ec->addrlen) && |
293 | (0 == memcmp (addr, ec->addr, addrlen)) && | ||
294 | (0 == strcmp (tname, ec->tname)) ) | ||
292 | { | 295 | { |
293 | ec->found = GNUNET_YES; | 296 | ec->found = GNUNET_YES; |
294 | ec->expiration = expiration; | 297 | ec->expiration = expiration; |
@@ -323,17 +326,20 @@ copy_latest (void *cls, | |||
323 | ec.addr = addr; | 326 | ec.addr = addr; |
324 | ec.addrlen = addrlen; | 327 | ec.addrlen = addrlen; |
325 | ec.found = GNUNET_NO; | 328 | ec.found = GNUNET_NO; |
329 | ec.tname = tname; | ||
326 | GNUNET_HELLO_iterate_addresses (mc->other, GNUNET_NO, &get_match_exp, &ec); | 330 | GNUNET_HELLO_iterate_addresses (mc->other, GNUNET_NO, &get_match_exp, &ec); |
327 | if ((ec.found == GNUNET_NO) || | 331 | if ( (ec.found == GNUNET_NO) || |
328 | ((ec.expiration.value < expiration.value) || | 332 | (ec.expiration.value < expiration.value) || |
329 | ((ec.expiration.value == expiration.value) && | 333 | ( (ec.expiration.value == expiration.value) && |
330 | (mc->take_equal == GNUNET_YES)))) | 334 | (mc->take_equal == GNUNET_YES) ) ) |
331 | mc->ret += GNUNET_HELLO_add_address (tname, | 335 | { |
332 | expiration, | 336 | mc->ret += GNUNET_HELLO_add_address (tname, |
333 | addr, | 337 | expiration, |
334 | addrlen, | 338 | addr, |
335 | &mc->buf[mc->ret], | 339 | addrlen, |
336 | mc->max - mc->ret); | 340 | &mc->buf[mc->ret], |
341 | mc->max - mc->ret); | ||
342 | } | ||
337 | return GNUNET_OK; | 343 | return GNUNET_OK; |
338 | } | 344 | } |
339 | 345 | ||
@@ -403,6 +409,7 @@ delta_match (void *cls, | |||
403 | ec.addr = addr; | 409 | ec.addr = addr; |
404 | ec.addrlen = addrlen; | 410 | ec.addrlen = addrlen; |
405 | ec.found = GNUNET_NO; | 411 | ec.found = GNUNET_NO; |
412 | ec.tname = tname; | ||
406 | GNUNET_HELLO_iterate_addresses (dc->old_hello, | 413 | GNUNET_HELLO_iterate_addresses (dc->old_hello, |
407 | GNUNET_NO, &get_match_exp, &ec); | 414 | GNUNET_NO, &get_match_exp, &ec); |
408 | if ((ec.found == GNUNET_YES) && | 415 | if ((ec.found == GNUNET_YES) && |