GNUNET_assert (0 < cp->ppd.pending_replies--);
}
GNUNET_LOAD_update (cp->ppd.transmission_delay,
- GNUNET_TIME_absolute_get_duration (pth->transmission_request_start_time).rel_value);
+ GNUNET_TIME_absolute_get_duration (pth->transmission_request_start_time).rel_value);
ret = pth->gmc (pth->gmc_cls,
- 0, NULL);
+ size, buf);
GNUNET_free (pth);
return ret;
}
{
struct GSF_PeerTransmitHandle *pth = cls;
struct GSF_ConnectedPeer *cp;
-
+
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Timeout trying to transmit to other peer\n");
+#endif
pth->timeout_task = GNUNET_SCHEDULER_NO_TASK;
cp = pth->cp;
GNUNET_CONTAINER_DLL_remove (cp->pth_head,
/* pth->cth could be NULL here, that's OK, we'll try again
later... */
}
+ else
+ {
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Not ready to ask for transmission to `%s'\n",
+ GNUNET_i2s (&target));
+#endif
+ }
if (pth->cth == NULL)
{
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "No transmission task scheduled, creating timeout task (%llu ms)\n",
+ (unsigned long long) timeout.rel_value);
+#endif
/* if we're waiting for reservation OR if we could not do notify_transmit_ready,
install a timeout task to be on the safe side */
pth->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
cp->migration_pth = NULL;
if (NULL == buf)
return 0;
- GNUNET_assert (size > sizeof (struct MigrationStopMessage));
+ GNUNET_assert (size >= sizeof (struct MigrationStopMessage));
msm.header.size = htons (sizeof (struct MigrationStopMessage));
msm.header.type = htons (GNUNET_MESSAGE_TYPE_FS_MIGRATION_STOP);
msm.duration = GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining (cp->last_migration_block));
GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
struct GNUNET_TIME_Relative block_time)
{
- if (GNUNET_TIME_absolute_get_duration (cp->last_migration_block).rel_value > block_time.rel_value)
- return; /* already blocked */
+ if (GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value > block_time.rel_value)
+ {
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Migration already blocked for another %llu ms\n",
+ (unsigned long long) GNUNET_TIME_absolute_get_remaining (cp->last_migration_block).rel_value);
+#endif
+ return; /* already blocked */
+ }
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Asking to stop migration for %llu ms\n",
+ (unsigned long long) block_time.rel_value);
+#endif
cp->last_migration_block = GNUNET_TIME_relative_to_absolute (block_time);
if (cp->migration_pth != NULL)
GSF_peer_transmit_cancel_ (cp->migration_pth);
* @author Christian Grothoff
*
* To use:
- * - GSF_plan_get_ (!)
- * - GSF_plan_size_ (?)
* - consider re-issue GSF_dht_lookup_ after non-DHT reply received
* - implement 'SUPPORT_DELAYS'
*
*/
#define COVER_AGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-/**
- * At what frequency should our datastore load decrease
- * automatically (since if we don't use it, clearly the
- * load must be going down).
- */
-#define DATASTORE_LOAD_AUTODECLINE GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250)
-
/* ****************************** globals ****************************** */
&put_migration_continuation,
start);
}
+ else
+ {
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Choosing not to keep content `%s' (%d/%d)\n",
+ GNUNET_h2s (&query),
+ active_to_migration,
+ test_put_load_too_high (prq.priority));
+#endif
+ }
putl = GNUNET_LOAD_get_load (datastore_put_load);
if ( (NULL != (cp = prq.sender)) &&
(GNUNET_NO == prq.request_found) &&
5000 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
(unsigned int) (60000 * putl * putl)));
GSF_block_peer_migration_ (cp, block_time);
- }
+ }
return GNUNET_OK;
}
_("Configuration fails to specify `%s', assuming default value."),
"MAX_PENDING_REQUESTS");
}
+ datastore_put_load = GNUNET_LOAD_value_init (DATASTORE_LOAD_AUTODECLINE);
pr_map = GNUNET_CONTAINER_multihashmap_create (32 * 1024);
requests_by_expiration_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
}
pr_map = NULL;
GNUNET_CONTAINER_heap_destroy (requests_by_expiration_heap);
requests_by_expiration_heap = NULL;
+ GNUNET_LOAD_value_free (datastore_put_load);
+ datastore_put_load = NULL;
}
peer->msg = NULL;
if (buf == NULL)
{
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Failed to migrate content to another peer (disconnect)\n");
+#endif
GNUNET_free (msg);
return 0;
}
GNUNET_assert (NULL == peer->th);
msize = sizeof (struct PutMessage) + block->size;
msg = GNUNET_malloc (msize);
- msg->header.type = htons (42);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
msg->header.size = htons (msize);
- GNUNET_break (0);
+ msg->type = htonl (block->type);
+ msg->expiration = GNUNET_TIME_absolute_hton (block->expiration);
memcpy (&msg[1],
&block[1],
block->size);
{
ret = GNUNET_NO;
}
+#if DEBUG_FS
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Asking for transmission of %u bytes for migration\n",
+ msize);
+#endif
peer->th = GSF_peer_transmit_ (peer->peer,
GNUNET_NO,
0 /* priority */,