aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_pr.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-16 17:34:18 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-16 17:34:18 +0000
commit0b92336e16fd941ec085c66579486244c6bd83f4 (patch)
treebbb47f96c7bba867018003de148654fd8ca0eab5 /src/fs/gnunet-service-fs_pr.c
parentf1cc760d1c98e2738430ad24d8004c5c700c1c49 (diff)
downloadgnunet-0b92336e16fd941ec085c66579486244c6bd83f4.tar.gz
gnunet-0b92336e16fd941ec085c66579486244c6bd83f4.zip
do not poll empty database every 100ms for migration, doxygen fixes, code cleanup
Diffstat (limited to 'src/fs/gnunet-service-fs_pr.c')
-rw-r--r--src/fs/gnunet-service-fs_pr.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index a9530f53a..f809efd6c 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -918,8 +918,8 @@ struct PutMigrationContext
918 struct GNUNET_PeerIdentity origin; 918 struct GNUNET_PeerIdentity origin;
919 919
920 /** 920 /**
921 * GNUNET_YES if we had a matching request for this block, 921 * #GNUNET_YES if we had a matching request for this block,
922 * GNUNET_NO if not. 922 * #GNUNET_NO if not.
923 */ 923 */
924 int requested; 924 int requested;
925}; 925};
@@ -992,8 +992,10 @@ put_migration_continuation (void *cls, int success,
992 ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2); 992 ppd->migration_delay = GNUNET_TIME_relative_multiply (ppd->migration_delay, 2);
993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 993 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
994 "Replicated content already exists locally, asking to stop migration for %s\n", 994 "Replicated content already exists locally, asking to stop migration for %s\n",
995 GNUNET_STRINGS_relative_time_to_string (mig_pause, GNUNET_YES)); 995 GNUNET_STRINGS_relative_time_to_string (mig_pause,
996 GSF_block_peer_migration_ (cp, GNUNET_TIME_relative_to_absolute (mig_pause)); 996 GNUNET_YES));
997 GSF_block_peer_migration_ (cp,
998 GNUNET_TIME_relative_to_absolute (mig_pause));
997 } 999 }
998 } 1000 }
999 GNUNET_free (pmc); 1001 GNUNET_free (pmc);
@@ -1048,13 +1050,16 @@ test_put_load_too_high (uint32_t priority)
1048 * @param data pointer to the result data 1050 * @param data pointer to the result data
1049 */ 1051 */
1050static void 1052static void
1051handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp, 1053handle_dht_reply (void *cls,
1052 const struct GNUNET_HashCode * key, 1054 struct GNUNET_TIME_Absolute exp,
1055 const struct GNUNET_HashCode *key,
1053 const struct GNUNET_PeerIdentity *get_path, 1056 const struct GNUNET_PeerIdentity *get_path,
1054 unsigned int get_path_length, 1057 unsigned int get_path_length,
1055 const struct GNUNET_PeerIdentity *put_path, 1058 const struct GNUNET_PeerIdentity *put_path,
1056 unsigned int put_path_length, enum GNUNET_BLOCK_Type type, 1059 unsigned int put_path_length,
1057 size_t size, const void *data) 1060 enum GNUNET_BLOCK_Type type,
1061 size_t size,
1062 const void *data)
1058{ 1063{
1059 struct GSF_PendingRequest *pr = cls; 1064 struct GSF_PendingRequest *pr = cls;
1060 struct ProcessReplyClosure prq; 1065 struct ProcessReplyClosure prq;
@@ -1089,7 +1094,10 @@ handle_dht_reply (void *cls, struct GNUNET_TIME_Absolute exp,
1089 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 1094 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
1090 &put_migration_continuation, pmc)) 1095 &put_migration_continuation, pmc))
1091 { 1096 {
1092 put_migration_continuation (pmc, GNUNET_SYSERR, GNUNET_TIME_UNIT_ZERO_ABS, NULL); 1097 put_migration_continuation (pmc,
1098 GNUNET_SYSERR,
1099 GNUNET_TIME_UNIT_ZERO_ABS,
1100 NULL);
1093 } 1101 }
1094 } 1102 }
1095} 1103}
@@ -1629,8 +1637,8 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr,
1629 * @param cp the other peer involved (sender or receiver, NULL 1637 * @param cp the other peer involved (sender or receiver, NULL
1630 * for loopback messages where we are both sender and receiver) 1638 * for loopback messages where we are both sender and receiver)
1631 * @param message the actual message 1639 * @param message the actual message
1632 * @return GNUNET_OK if the message was well-formed, 1640 * @return #GNUNET_OK if the message was well-formed,
1633 * GNUNET_SYSERR if the message was malformed (close connection, 1641 * #GNUNET_SYSERR if the message was malformed (close connection,
1634 * do not cache under any circumstances) 1642 * do not cache under any circumstances)
1635 */ 1643 */
1636int 1644int
@@ -1661,10 +1669,14 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1661 /* do not allow migrated content to live longer than 1 year */ 1669 /* do not allow migrated content to live longer than 1 year */
1662 expiration = GNUNET_TIME_absolute_min (GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS), 1670 expiration = GNUNET_TIME_absolute_min (GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS),
1663 expiration); 1671 expiration);
1664 if (type == GNUNET_BLOCK_TYPE_FS_ONDEMAND) 1672 if (GNUNET_BLOCK_TYPE_FS_ONDEMAND == type)
1665 return GNUNET_SYSERR; 1673 return GNUNET_SYSERR;
1666 if (GNUNET_OK != 1674 if (GNUNET_OK !=
1667 GNUNET_BLOCK_get_key (GSF_block_ctx, type, &put[1], dsize, &query)) 1675 GNUNET_BLOCK_get_key (GSF_block_ctx,
1676 type,
1677 &put[1],
1678 dsize,
1679 &query))
1668 { 1680 {
1669 GNUNET_break_op (0); 1681 GNUNET_break_op (0);
1670 return GNUNET_SYSERR; 1682 return GNUNET_SYSERR;
@@ -1681,7 +1693,9 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1681 prq.priority = 0; 1693 prq.priority = 0;
1682 prq.anonymity_level = UINT32_MAX; 1694 prq.anonymity_level = UINT32_MAX;
1683 prq.request_found = GNUNET_NO; 1695 prq.request_found = GNUNET_NO;
1684 GNUNET_CONTAINER_multihashmap_get_multiple (pr_map, &query, &process_reply, 1696 GNUNET_CONTAINER_multihashmap_get_multiple (pr_map,
1697 &query,
1698 &process_reply,
1685 &prq); 1699 &prq);
1686 if (NULL != cp) 1700 if (NULL != cp)
1687 { 1701 {
@@ -1696,7 +1710,8 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1696 { 1710 {
1697 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1711 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1698 "Replicating result for query `%s' with priority %u\n", 1712 "Replicating result for query `%s' with priority %u\n",
1699 GNUNET_h2s (&query), prq.priority); 1713 GNUNET_h2s (&query),
1714 prq.priority);
1700 pmc = GNUNET_new (struct PutMigrationContext); 1715 pmc = GNUNET_new (struct PutMigrationContext);
1701 pmc->start = GNUNET_TIME_absolute_get (); 1716 pmc->start = GNUNET_TIME_absolute_get ();
1702 pmc->requested = prq.request_found; 1717 pmc->requested = prq.request_found;
@@ -1711,7 +1726,10 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1711 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 1726 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
1712 &put_migration_continuation, pmc)) 1727 &put_migration_continuation, pmc))
1713 { 1728 {
1714 put_migration_continuation (pmc, GNUNET_SYSERR, GNUNET_TIME_UNIT_ZERO_ABS, NULL); 1729 put_migration_continuation (pmc,
1730 GNUNET_SYSERR,
1731 GNUNET_TIME_UNIT_ZERO_ABS,
1732 NULL);
1715 } 1733 }
1716 } 1734 }
1717 else if (NULL != cp) 1735 else if (NULL != cp)