fix for 1819:
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 4 Oct 2011 09:57:35 +0000 (09:57 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 4 Oct 2011 09:57:35 +0000 (09:57 +0000)
when HELLO message arrives, peer's public key is added to peerinfo even no addresses could be validated

src/transport/gnunet-service-transport_validation.c

index 7fcb76396dfe3574a995752e95235c1059dfbb0e..e16ccb56b957aa75290a73a2d9e020697ade24b2 100644 (file)
@@ -1021,6 +1021,7 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
   const struct GNUNET_HELLO_Message *hm =
       (const struct GNUNET_HELLO_Message *) hello;
   struct ValidateAddressContext vac;
+  struct GNUNET_HELLO_Message *h;
 
   if ((GNUNET_OK != GNUNET_HELLO_get_id (hm, &vac.pid)) ||
       (GNUNET_OK != GNUNET_HELLO_get_key (hm, &vac.public_key)))
@@ -1029,6 +1030,18 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello)
     GNUNET_break (0);
     return;
   }
+  /* Add peer identity without addresses to peerinfo service */
+  h = GNUNET_HELLO_create (&vac.public_key, NULL, NULL);
+  GNUNET_PEERINFO_add_peer (GST_peerinfo, h);
+#if VERBOSE_VALIDATION
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              _
+              ("Adding `%s' without addresses for peer `%s'\n"),
+              "HELLO",
+              GNUNET_i2s(&vac.pid));
+#endif
+  GNUNET_free (h);
+
   GNUNET_assert (NULL ==
                  GNUNET_HELLO_iterate_addresses (hm, GNUNET_NO,
                                                  &validate_address, &vac));