*/
void
GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
- struct GNUNET_TIME_Relative block_time)
+ struct GNUNET_TIME_Absolute block_time)
{
- if (GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value >
- block_time.rel_value)
+ if (cp->last_migration_block.abs_value > block_time.abs_value)
{
-#if DEBUG_FS && 0
+#if DEBUG_FS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Migration already blocked for another %llu ms\n",
(unsigned long long)
}
#if DEBUG_FS && 0
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n",
- (unsigned long long) block_time.rel_value);
+ (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value);
#endif
- cp->last_migration_block = GNUNET_TIME_relative_to_absolute (block_time);
+ cp->last_migration_block = block_time;
if (cp->migration_pth != NULL)
GSF_peer_transmit_cancel_ (cp->migration_pth);
cp->migration_pth =
*/
unsigned int pending_replies;
- /**
- * How many of the last blocks from migration were duplicates?
- */
- unsigned int migration_duplication;
};
*/
void
GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
- struct GNUNET_TIME_Relative block_time);
+ struct GNUNET_TIME_Absolute block_time);
/**
const char *msg)
{
struct PutMigrationContext *pmc = cls;
- struct GNUNET_TIME_Relative block_time;
struct GSF_ConnectedPeer *cp;
- struct GSF_PeerPerformanceData *ppd;
cp = GSF_peer_get_ (&pmc->origin);
- if ((GNUNET_OK != success) && (GNUNET_NO == pmc->requested))
- {
- /* block migration for a bit... */
- if (NULL != cp)
- {
- ppd = GSF_get_peer_performance_data_ (cp);
- ppd->migration_duplication++;
- block_time =
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
- 5 * ppd->migration_duplication +
- GNUNET_CRYPTO_random_u32
- (GNUNET_CRYPTO_QUALITY_WEAK, 5));
- GSF_block_peer_migration_ (cp, block_time);
- }
- }
- else
- {
- if (NULL != cp)
- {
- ppd = GSF_get_peer_performance_data_ (cp);
- ppd->migration_duplication = 0; /* reset counter */
- }
- }
+ if ((GNUNET_OK != success) && (GNUNET_NO == pmc->requested) && (min_expiration.abs_value > 0)&&
+ (NULL != cp) )
+ GSF_block_peer_migration_ (cp, min_expiration);
GNUNET_free (pmc);
/* on failure, increase the put load dramatically */
if (NULL != datastore_put_load)
GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK,
(unsigned int) (60000 * putl * putl)));
- GSF_block_peer_migration_ (cp, block_time);
+ GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (block_time));
}
return GNUNET_OK;
}