- struct GNUNET_GNS_Handle *handle = cls;
- struct GNUNET_GNS_LookupRequest *lr;
- const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg;
- uint32_t r_id;
-
- if (NULL == msg)
- {
- force_reconnect (handle);
- return;
- }
- switch (ntohs (msg->type))
- {
- case GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got LOOKUP_RESULT msg\n");
- if (ntohs (msg->size) < sizeof (struct GNUNET_GNS_ClientLookupResultMessage))
- {
- GNUNET_break (0);
- force_reconnect (handle);
- return;
- }
- lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg;
- r_id = ntohl (lookup_msg->id);
- for (lr = handle->lookup_head; NULL != lr; lr = lr->next)
- if (lr->r_id == r_id)
- {
- process_lookup_reply(lr, lookup_msg);
- break;
- }
- break;
- default:
- GNUNET_break (0);
- force_reconnect (handle);
+ struct GNUNET_MQ_MessageHandler handlers[] = {
+ GNUNET_MQ_hd_var_size (result,
+ GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT,
+ struct LookupResultMessage,
+ handle),
+ GNUNET_MQ_handler_end ()
+ };
+ struct GNUNET_GNS_LookupRequest *lh;
+
+ GNUNET_assert (NULL == handle->mq);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Trying to connect to GNS\n");
+ handle->mq = GNUNET_CLIENT_connect (handle->cfg,
+ "gns",
+ handlers,
+ &mq_error_handler,
+ handle);
+ if (NULL == handle->mq)