gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14020 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r14020 - gnunet/src/fs
Date: Wed, 22 Dec 2010 11:54:44 +0100

Author: grothoff
Date: 2010-12-22 11:54:44 +0100 (Wed, 22 Dec 2010)
New Revision: 14020

Modified:
   gnunet/src/fs/gnunet-service-fs.c
Log:
fix

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2010-12-22 10:49:17 UTC (rev 14019)
+++ gnunet/src/fs/gnunet-service-fs.c   2010-12-22 10:54:44 UTC (rev 14020)
@@ -771,6 +771,10 @@
   enum GNUNET_BLOCK_Type type;
 };
 
+/**
+ * Identity of this peer.
+ */
+static struct GNUNET_PeerIdentity my_id;
 
 /**
  * Our connection to the datastore.
@@ -1615,6 +1619,8 @@
 static struct GNUNET_TIME_Relative
 get_latency (const struct GNUNET_TRANSPORT_ATS_Information *atsi)
 {
+  if (atsi == NULL)
+    return GNUNET_TIME_UNIT_SECONDS;
   while ( (ntohl (atsi->type) != GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR) &&
          (ntohl (atsi->type) != GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY) )
     atsi++;
@@ -1648,6 +1654,8 @@
   uint32_t trust;
   struct GNUNET_TIME_Relative latency;
 
+  if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity)))
+    return;
   latency = get_latency (atsi);
   cp = GNUNET_CONTAINER_multihashmap_get (connected_peers,
                                          &peer->hashPubKey);
@@ -1856,6 +1864,8 @@
   struct MigrationReadyBlock *pos;
   struct MigrationReadyBlock *next;
 
+  if (0 == memcmp (&my_id, peer, sizeof (struct GNUNET_PeerIdentity)))
+    return;
   GNUNET_CONTAINER_multihashmap_get_multiple (peer_request_map,
                                              &peer->hashPubKey,
                                              &destroy_request,
@@ -4589,7 +4599,36 @@
 
 /* **************************** Startup ************************ */
 
+
+
 /**
+ * Function called after GNUNET_CORE_connect has succeeded
+ * (or failed for good).  Note that the private key of the
+ * peer is intentionally not exposed here; if you need it,
+ * your process should try to read the private key file
+ * directly (which should work if you are authorized...).
+ *
+ * @param cls closure
+ * @param server handle to the server, NULL if we failed
+ * @param my_identity ID of this peer, NULL if we failed
+ * @param publicKey public key of this peer, NULL if we failed
+ */
+static void
+peer_init_handler (void *cls,
+                  struct GNUNET_CORE_Handle * server,
+                  const struct GNUNET_PeerIdentity *
+                  my_identity,
+                  const struct
+                  GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *
+                  publicKey)
+{
+  my_id = *my_identity;
+}
+
+
+
+
+/**
  * Process fs requests.
  *
  * @param server the initialized server
@@ -4653,7 +4692,7 @@
   core = GNUNET_CORE_connect (cfg,
                              1, /* larger? */
                              NULL,
-                             NULL,
+                             &peer_init_handler,
                              &peer_connect_handler,
                              &peer_disconnect_handler,
                              &peer_status_handler,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]