- if (msg == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to receive response from `%s' service.\n"),
- "peerinfo");
- ic->callback (ic->callback_cls, NULL, NULL, 1);
- GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO);
- GNUNET_free (ic);
- return;
- }
- if (ntohs (msg->type) == GNUNET_MESSAGE_TYPE_PEERINFO_INFO_END)
- {
-#if DEBUG_PEERINFO
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received end of list of peers from peerinfo database\n");
-#endif
- ic->callback (ic->callback_cls, NULL, NULL, 0);
- GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO);
- GNUNET_free (ic);
- return;
- }
- ms = ntohs (msg->size);
- if ((ms < sizeof (struct InfoMessage)) ||
- (ntohs (msg->type) != GNUNET_MESSAGE_TYPE_PEERINFO_INFO))
- {
- GNUNET_break (0);
- ic->callback (ic->callback_cls, NULL, NULL, 2);
- GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO);
- GNUNET_free (ic);
- return;
- }
- im = (const struct InfoMessage *) msg;
- hello = NULL;
- if (ms > sizeof (struct InfoMessage) + sizeof (struct GNUNET_MessageHeader))
- {
- hello = (const struct GNUNET_HELLO_Message *) &im[1];
- if (ms != sizeof (struct InfoMessage) + GNUNET_HELLO_size (hello))
- {
- GNUNET_break (0);
- ic->callback (ic->callback_cls, NULL, NULL, 2);
- GNUNET_CLIENT_disconnect (ic->client, GNUNET_NO);
- GNUNET_free (ic);
- return;
- }
- }
-#if DEBUG_PEERINFO
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received information about peer `%s' from peerinfo database\n",
- GNUNET_i2s (&im->peer));
-#endif
-#if DEBUG_PEERINFO
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Size of `%s' is %u bytes\n",
- "HELLO",
- (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello));
-#endif
- ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust));
- GNUNET_CLIENT_receive (ic->client,
- &info_handler,
- ic,
- GNUNET_TIME_absolute_get_remaining (ic->timeout));