aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-12-22 10:54:44 +0000
committerChristian Grothoff <christian@grothoff.org>2010-12-22 10:54:44 +0000
commitb490bb6d8ce680cce93d3ac44d934c8f38cd0ddc (patch)
tree4e31b0ce67a6f94031fa48a9b17e7f1c36a7f7f4 /src/fs/gnunet-service-fs.c
parent734207e5ace38782b11b1a54d1448fce2722e312 (diff)
downloadgnunet-b490bb6d8ce680cce93d3ac44d934c8f38cd0ddc.tar.gz
gnunet-b490bb6d8ce680cce93d3ac44d934c8f38cd0ddc.zip
fix
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r--src/fs/gnunet-service-fs.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index e522133e0..08e864a10 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -771,6 +771,10 @@ struct MigrationReadyBlock
771 enum GNUNET_BLOCK_Type type; 771 enum GNUNET_BLOCK_Type type;
772}; 772};
773 773
774/**
775 * Identity of this peer.
776 */
777static struct GNUNET_PeerIdentity my_id;
774 778
775/** 779/**
776 * Our connection to the datastore. 780 * Our connection to the datastore.
@@ -1615,6 +1619,8 @@ destroy_pending_request (struct PendingRequest *pr)
1615static struct GNUNET_TIME_Relative 1619static struct GNUNET_TIME_Relative
1616get_latency (const struct GNUNET_TRANSPORT_ATS_Information *atsi) 1620get_latency (const struct GNUNET_TRANSPORT_ATS_Information *atsi)
1617{ 1621{
1622 if (atsi == NULL)
1623 return GNUNET_TIME_UNIT_SECONDS;
1618 while ( (ntohl (atsi->type) != GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR) && 1624 while ( (ntohl (atsi->type) != GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR) &&
1619 (ntohl (atsi->type) != GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY) ) 1625 (ntohl (atsi->type) != GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY) )
1620 atsi++; 1626 atsi++;
@@ -1648,6 +1654,8 @@ peer_connect_handler (void *cls,
1648 uint32_t trust; 1654 uint32_t trust;
1649 struct GNUNET_TIME_Relative latency; 1655 struct GNUNET_TIME_Relative latency;
1650 1656
1657 if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity)))
1658 return;
1651 latency = get_latency (atsi); 1659 latency = get_latency (atsi);
1652 cp = GNUNET_CONTAINER_multihashmap_get (connected_peers, 1660 cp = GNUNET_CONTAINER_multihashmap_get (connected_peers,
1653 &peer->hashPubKey); 1661 &peer->hashPubKey);
@@ -1856,6 +1864,8 @@ peer_disconnect_handler (void *cls,
1856 struct MigrationReadyBlock *pos; 1864 struct MigrationReadyBlock *pos;
1857 struct MigrationReadyBlock *next; 1865 struct MigrationReadyBlock *next;
1858 1866
1867 if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity)))
1868 return;
1859 GNUNET_CONTAINER_multihashmap_get_multiple (peer_request_map, 1869 GNUNET_CONTAINER_multihashmap_get_multiple (peer_request_map,
1860 &peer->hashPubKey, 1870 &peer->hashPubKey,
1861 &destroy_request, 1871 &destroy_request,
@@ -4589,6 +4599,35 @@ handle_start_search (void *cls,
4589 4599
4590/* **************************** Startup ************************ */ 4600/* **************************** Startup ************************ */
4591 4601
4602
4603
4604/**
4605 * Function called after GNUNET_CORE_connect has succeeded
4606 * (or failed for good). Note that the private key of the
4607 * peer is intentionally not exposed here; if you need it,
4608 * your process should try to read the private key file
4609 * directly (which should work if you are authorized...).
4610 *
4611 * @param cls closure
4612 * @param server handle to the server, NULL if we failed
4613 * @param my_identity ID of this peer, NULL if we failed
4614 * @param publicKey public key of this peer, NULL if we failed
4615 */
4616static void
4617peer_init_handler (void *cls,
4618 struct GNUNET_CORE_Handle * server,
4619 const struct GNUNET_PeerIdentity *
4620 my_identity,
4621 const struct
4622 GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *
4623 publicKey)
4624{
4625 my_id = *my_identity;
4626}
4627
4628
4629
4630
4592/** 4631/**
4593 * Process fs requests. 4632 * Process fs requests.
4594 * 4633 *
@@ -4653,7 +4692,7 @@ main_init (struct GNUNET_SERVER_Handle *server,
4653 core = GNUNET_CORE_connect (cfg, 4692 core = GNUNET_CORE_connect (cfg,
4654 1, /* larger? */ 4693 1, /* larger? */
4655 NULL, 4694 NULL,
4656 NULL, 4695 &peer_init_handler,
4657 &peer_connect_handler, 4696 &peer_connect_handler,
4658 &peer_disconnect_handler, 4697 &peer_disconnect_handler,
4659 &peer_status_handler, 4698 &peer_status_handler,