[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14745 - gnunet/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14745 - gnunet/src/fs |
Date: |
Sun, 27 Mar 2011 16:08:36 +0200 |
Author: grothoff
Date: 2011-03-27 16:08:36 +0200 (Sun, 27 Mar 2011)
New Revision: 14745
Modified:
gnunet/src/fs/gnunet-service-fs.h
gnunet/src/fs/gnunet-service-fs_cp.c
gnunet/src/fs/gnunet-service-fs_new.c
gnunet/src/fs/gnunet-service-fs_pr.c
gnunet/src/fs/gnunet-service-fs_push.c
Log:
stuff
Modified: gnunet/src/fs/gnunet-service-fs.h
===================================================================
--- gnunet/src/fs/gnunet-service-fs.h 2011-03-27 12:16:22 UTC (rev 14744)
+++ gnunet/src/fs/gnunet-service-fs.h 2011-03-27 14:08:36 UTC (rev 14745)
@@ -56,7 +56,15 @@
#define SUPPORT_DELAYS GNUNET_NO
+/**
+ * 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)
+
+
/**
* A connected peer.
*/
Modified: gnunet/src/fs/gnunet-service-fs_cp.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cp.c 2011-03-27 12:16:22 UTC (rev
14744)
+++ gnunet/src/fs/gnunet-service-fs_cp.c 2011-03-27 14:08:36 UTC (rev
14745)
@@ -324,9 +324,9 @@
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;
}
@@ -1057,7 +1057,11 @@
{
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,
@@ -1184,8 +1188,21 @@
/* 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,
@@ -1490,7 +1507,7 @@
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));
@@ -1510,8 +1527,20 @@
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);
Modified: gnunet/src/fs/gnunet-service-fs_new.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_new.c 2011-03-27 12:16:22 UTC (rev
14744)
+++ gnunet/src/fs/gnunet-service-fs_new.c 2011-03-27 14:08:36 UTC (rev
14745)
@@ -24,8 +24,6 @@
* @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'
*
@@ -67,14 +65,7 @@
*/
#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 ****************************** */
/**
Modified: gnunet/src/fs/gnunet-service-fs_pr.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_pr.c 2011-03-27 12:16:22 UTC (rev
14744)
+++ gnunet/src/fs/gnunet-service-fs_pr.c 2011-03-27 14:08:36 UTC (rev
14745)
@@ -1189,6 +1189,16 @@
&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) &&
@@ -1201,7 +1211,7 @@
5000 +
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
(unsigned int) (60000 * putl * putl)));
GSF_block_peer_migration_ (cp, block_time);
- }
+ }
return GNUNET_OK;
}
@@ -1222,6 +1232,7 @@
_("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);
}
@@ -1240,6 +1251,8 @@
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;
}
Modified: gnunet/src/fs/gnunet-service-fs_push.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_push.c 2011-03-27 12:16:22 UTC (rev
14744)
+++ gnunet/src/fs/gnunet-service-fs_push.c 2011-03-27 14:08:36 UTC (rev
14745)
@@ -219,6 +219,10 @@
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;
}
@@ -257,9 +261,10 @@
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);
@@ -282,6 +287,11 @@
{
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 */,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14745 - gnunet/src/fs,
gnunet <=