diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-06-01 15:36:14 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-06-01 15:36:14 +0000 |
commit | c835d0bd4b765026a7b1884d236e1975a929f77a (patch) | |
tree | 2b770defa1c8bb1800f4dd48573ea014580752f2 /src | |
parent | 170bd1ef6bbac60604183d4f8d8315f30ac664b7 (diff) | |
download | gnunet-c835d0bd4b765026a7b1884d236e1975a929f77a.tar.gz gnunet-c835d0bd4b765026a7b1884d236e1975a929f77a.zip |
fix for 0002392
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 7412cee19..9bf5ca678 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -355,11 +355,10 @@ GAS_addresses_update (const struct GNUNET_PeerIdentity *peer, | |||
355 | aa->ats_count = atsi_count; | 355 | aa->ats_count = atsi_count; |
356 | memcpy (aa->ats, atsi, atsi_count * sizeof (struct GNUNET_ATS_Information)); | 356 | memcpy (aa->ats, atsi, atsi_count * sizeof (struct GNUNET_ATS_Information)); |
357 | 357 | ||
358 | #if DEBUG_ATS | ||
359 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' %u\n", | 358 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating address for peer `%s' %u\n", |
360 | GNUNET_i2s (peer), | 359 | GNUNET_i2s (peer), |
361 | session_id); | 360 | session_id); |
362 | #endif | 361 | |
363 | /* Get existing address or address with session == 0 */ | 362 | /* Get existing address or address with session == 0 */ |
364 | old = find_address (peer, aa); | 363 | old = find_address (peer, aa); |
365 | if (old == NULL) | 364 | if (old == NULL) |
@@ -458,11 +457,11 @@ destroy_by_session_id (void *cls, const GNUNET_HashCode * key, void *value) | |||
458 | (aa->addr_len == info->addr_len) && | 457 | (aa->addr_len == info->addr_len) && |
459 | (0 == memcmp (info->addr, aa->addr, aa->addr_len))) | 458 | (0 == memcmp (info->addr, aa->addr, aa->addr_len))) |
460 | { | 459 | { |
461 | #if VERBOSE | 460 | |
462 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 461 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
463 | "Deleting address for peer `%s': `%s' %u\n", | 462 | "Deleting address for peer `%s': `%s' %u\n", |
464 | GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id); | 463 | GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id); |
465 | #endif | 464 | |
466 | if (GNUNET_YES == destroy_address (aa)) | 465 | if (GNUNET_YES == destroy_address (aa)) |
467 | recalculate_assigned_bw (); | 466 | recalculate_assigned_bw (); |
468 | return GNUNET_OK; | 467 | return GNUNET_OK; |
@@ -559,13 +558,36 @@ find_address_it (void *cls, const GNUNET_HashCode * key, void *value) | |||
559 | return GNUNET_OK; | 558 | return GNUNET_OK; |
560 | } | 559 | } |
561 | 560 | ||
562 | |||
563 | aa->block_interval = GNUNET_TIME_relative_add (aa->block_interval, ATS_BLOCKING_DELTA); | 561 | aa->block_interval = GNUNET_TIME_relative_add (aa->block_interval, ATS_BLOCKING_DELTA); |
564 | aa->blocked_until = GNUNET_TIME_absolute_add (now, aa->block_interval); | 562 | aa->blocked_until = GNUNET_TIME_absolute_add (now, aa->block_interval); |
565 | 563 | ||
566 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 564 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
567 | "Address %p ready for suggestion, block interval now %llu \n", aa, aa->block_interval); | 565 | "Address %p ready for suggestion, block interval now %llu \n", aa, aa->block_interval); |
568 | 566 | ||
567 | /* FIXME this is a hack */ | ||
568 | |||
569 | |||
570 | if (NULL != ab) | ||
571 | { | ||
572 | if ((0 == strcmp (ab->plugin, "tcp")) && | ||
573 | (0 == strcmp (aa->plugin, "tcp"))) | ||
574 | { | ||
575 | if ((0 != ab->addr_len) && | ||
576 | (0 == aa->addr_len)) | ||
577 | { | ||
578 | /* saved address was an outbound address, but we have an inbound address */ | ||
579 | *ap = aa; | ||
580 | return GNUNET_OK; | ||
581 | } | ||
582 | if (0 == ab->addr_len) | ||
583 | { | ||
584 | /* saved address was an inbound address, so do not overwrite */ | ||
585 | return GNUNET_OK; | ||
586 | } | ||
587 | } | ||
588 | } | ||
589 | /* FIXME end of hack */ | ||
590 | |||
569 | if (NULL == ab) | 591 | if (NULL == ab) |
570 | { | 592 | { |
571 | *ap = aa; | 593 | *ap = aa; |