diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-14 18:39:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-14 18:39:08 +0000 |
commit | c50146d0d092d7881c58df46c237d8b50410a3a4 (patch) | |
tree | 644103207534bd2a0e0c0c6cc4f21b3805b21429 /src/fs/gnunet-service-fs_cp.c | |
parent | 4d4c1f978d4044d4ac9706f17342d8425337486c (diff) | |
download | gnunet-c50146d0d092d7881c58df46c237d8b50410a3a4.tar.gz gnunet-c50146d0d092d7881c58df46c237d8b50410a3a4.zip |
-optimizing all FS multi hashmaps for key memory sharing
Diffstat (limited to 'src/fs/gnunet-service-fs_cp.c')
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 3de45ff48..916289dff 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -315,6 +315,7 @@ static char *respectDirectory; | |||
315 | */ | 315 | */ |
316 | static struct GNUNET_ATS_PerformanceHandle *ats; | 316 | static struct GNUNET_ATS_PerformanceHandle *ats; |
317 | 317 | ||
318 | |||
318 | /** | 319 | /** |
319 | * Get the filename under which we would store respect | 320 | * Get the filename under which we would store respect |
320 | * for the given peer. | 321 | * for the given peer. |
@@ -617,7 +618,8 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, | |||
617 | GNUNET_free (fn); | 618 | GNUNET_free (fn); |
618 | cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 619 | cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); |
619 | GNUNET_break (GNUNET_OK == | 620 | GNUNET_break (GNUNET_OK == |
620 | GNUNET_CONTAINER_multihashmap_put (cp_map, &peer->hashPubKey, | 621 | GNUNET_CONTAINER_multihashmap_put (cp_map, |
622 | &GSF_connected_peer_get_identity2_ (cp)->hashPubKey, | ||
621 | cp, | 623 | cp, |
622 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 624 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
623 | GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# peers connected"), | 625 | GNUNET_STATISTICS_set (GSF_stats, gettext_noop ("# peers connected"), |
@@ -1646,7 +1648,7 @@ GSF_iterate_connected_peers_ (GSF_ConnectedPeerIterator it, void *it_cls) | |||
1646 | /** | 1648 | /** |
1647 | * Obtain the identity of a connected peer. | 1649 | * Obtain the identity of a connected peer. |
1648 | * | 1650 | * |
1649 | * @param cp peer to reserve bandwidth from | 1651 | * @param cp peer to get identity of |
1650 | * @param id identity to set (written to) | 1652 | * @param id identity to set (written to) |
1651 | */ | 1653 | */ |
1652 | void | 1654 | void |
@@ -1659,6 +1661,20 @@ GSF_connected_peer_get_identity_ (const struct GSF_ConnectedPeer *cp, | |||
1659 | 1661 | ||
1660 | 1662 | ||
1661 | /** | 1663 | /** |
1664 | * Obtain the identity of a connected peer. | ||
1665 | * | ||
1666 | * @param cp peer to get identity of | ||
1667 | * @return reference to peer identity, valid until peer disconnects (!) | ||
1668 | */ | ||
1669 | const struct GNUNET_PeerIdentity * | ||
1670 | GSF_connected_peer_get_identity2_ (const struct GSF_ConnectedPeer *cp) | ||
1671 | { | ||
1672 | GNUNET_assert (0 != cp->ppd.pid); | ||
1673 | return GNUNET_PEER_resolve2 (cp->ppd.pid); | ||
1674 | } | ||
1675 | |||
1676 | |||
1677 | /** | ||
1662 | * Assemble a migration stop message for transmission. | 1678 | * Assemble a migration stop message for transmission. |
1663 | * | 1679 | * |
1664 | * @param cls the 'struct GSF_ConnectedPeer' to use | 1680 | * @param cls the 'struct GSF_ConnectedPeer' to use |
@@ -1811,7 +1827,7 @@ cron_flush_respect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1811 | void | 1827 | void |
1812 | GSF_connected_peer_init_ () | 1828 | GSF_connected_peer_init_ () |
1813 | { | 1829 | { |
1814 | cp_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 1830 | cp_map = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_YES); |
1815 | ats = GNUNET_ATS_performance_init (GSF_cfg, NULL, NULL); | 1831 | ats = GNUNET_ATS_performance_init (GSF_cfg, NULL, NULL); |
1816 | GNUNET_assert (GNUNET_OK == | 1832 | GNUNET_assert (GNUNET_OK == |
1817 | GNUNET_CONFIGURATION_get_value_filename (GSF_cfg, "fs", | 1833 | GNUNET_CONFIGURATION_get_value_filename (GSF_cfg, "fs", |