-#if DEBUG_PEERINFO
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received %u bytes of `%s' information about peer `%s' from `%s' service\n",
- (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello),
- "HELLO",
- GNUNET_i2s (&im->peer),
- "PEERINFO");
-#endif
- ic->h->in_receive = GNUNET_YES;
- if (ic->callback != NULL)
- ic->callback (ic->callback_cls, &im->peer, hello, NULL);
- GNUNET_CLIENT_receive (ic->h->client,
- &peerinfo_handler,
- ic,
+ if (GNUNET_OK != GNUNET_HELLO_get_id (hello, &id))
+ {
+ /* malformed message */
+ GNUNET_break (0);
+ GNUNET_PEERINFO_iterate_cancel (ic);
+ reconnect (h);
+ if (NULL != cb)
+ cb (cb_cls, NULL, NULL,
+ _("Received invalid message from `PEERINFO' service."));
+ return;
+ }
+ if (0 != memcmp (&im->peer, &id, sizeof (struct GNUNET_PeerIdentity)))
+ {
+ /* malformed message */
+ GNUNET_break (0);
+ GNUNET_PEERINFO_iterate_cancel (ic);
+ reconnect (h);
+ if (NULL != cb)
+ cb (cb_cls, NULL, NULL,
+ _("Received invalid message from `PEERINFO' service."));
+ return;
+ }
+ }
+
+ /* normal data message */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received %u bytes of `%s' information about peer `%s' from `%s' service\n",
+ (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello), "HELLO",
+ GNUNET_i2s (&im->peer), "PEERINFO");
+ h->in_receive = GNUNET_YES;
+ GNUNET_CLIENT_receive (h->client, &peerinfo_handler, h,