+ if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &pid))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ if (0 == memcmp (&pid, &my_identity, sizeof (struct GNUNET_PeerIdentity)))
+ return; /* that's me! */
+ have_address = GNUNET_NO;
+ GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &address_iterator,
+ &have_address);
+ if (GNUNET_NO == have_address)
+ return; /* no point in advertising this one... */
+ peer = GNUNET_CONTAINER_multihashmap_get (peers, &pid.hashPubKey);
+ if (peer == NULL)
+ {
+ peer = make_peer (&pid, hello, GNUNET_NO);
+ }
+ else if (peer->hello != NULL)
+ {
+ dt = GNUNET_HELLO_equals (peer->hello, hello, GNUNET_TIME_absolute_get ());
+ if (dt.abs_value == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value)
+ return; /* nothing new here */
+ }
+#if DEBUG_TOPOLOGY
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found `%s' from peer `%s' for advertising\n", "HELLO",
+ GNUNET_i2s (&pid));
+#endif
+ if (peer->hello != NULL)
+ {
+ nh = GNUNET_HELLO_merge (peer->hello, hello);
+ GNUNET_free (peer->hello);
+ peer->hello = nh;
+ }
+ else
+ {
+ size = GNUNET_HELLO_size (hello);
+ peer->hello = GNUNET_malloc (size);
+ memcpy (peer->hello, hello, size);
+ }
+ if (peer->filter != NULL)
+ GNUNET_CONTAINER_bloomfilter_free (peer->filter);
+ setup_filter (peer);
+ /* since we have a new HELLO to pick from, re-schedule all
+ * HELLO requests that are not bound by the HELLO send rate! */
+ GNUNET_CONTAINER_multihashmap_iterate (peers, &reschedule_hellos, peer);