- if (br->client != NULL)
- GNUNET_CLIENT_disconnect (br->client, GNUNET_NO);
- br->client = GNUNET_CLIENT_connect (br->sched,
- "transport",
- br->cfg);
- br->th = GNUNET_CLIENT_notify_transmit_ready (br->client,
- sizeof (struct GNUNET_MessageHeader),
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_YES,
- &transmit_blacklist_init,
- br);
-}
-
-
-/**
- * Transmit the blacklist response to the service.
- *
- * @param cls closure (struct GNUNET_TRANSPORT_Blacklist*)
- * @param size number of bytes available in buf
- * @param buf where the callee should write the message
- * @return number of bytes written to buf
- */
-static size_t
-transmit_blacklist_reply (void *cls,
- size_t size, void *buf)
-{
- struct GNUNET_TRANSPORT_Blacklist *br = cls;
- struct BlacklistMessage req;
-
- if (buf == NULL)
- {
- reconnect (br);
- return 0;
- }
- req.header.size = htons (sizeof (req));
- req.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY);
- req.is_allowed = htonl (br->cb (br->cb_cls, &br->peer));
- req.peer = br->peer;
- memcpy (buf, &req, sizeof (req));
- receive (br);
- return sizeof (req);
-}
-
-
-/**
- * Send our reply to a blacklisting request.
- *
- * @param br our overall context
- */
-static void
-reply (struct GNUNET_TRANSPORT_Blacklist *br)
-{
- br->th = GNUNET_CLIENT_notify_transmit_ready (br->client,
- sizeof (struct BlacklistMessage),
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_NO,
- &transmit_blacklist_reply,
- br);
- if (br->th == NULL)
- {
- reconnect (br);
- return;
- }
+ struct GNUNET_MQ_MessageHandler handlers[] = {
+ GNUNET_MQ_hd_fixed_size (query,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY,
+ struct BlacklistMessage,
+ br),
+ GNUNET_MQ_handler_end ()
+ };
+ struct GNUNET_MQ_Envelope *env;
+ struct GNUNET_MessageHeader *req;
+
+ if (NULL != br->mq)
+ GNUNET_MQ_destroy (br->mq);
+ br->mq = GNUNET_CLIENT_connect (br->cfg,
+ "transport",
+ handlers,
+ &mq_error_handler,
+ br);
+ if (NULL == br->mq)
+ return;
+ env = GNUNET_MQ_msg (req,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT);
+ GNUNET_MQ_send (br->mq,
+ env);