* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_client_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_hello_lib.h"
#include "gnunet_protocols.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_time_lib.h"
#include "gnunet_transport_service.h"
#include "transport.h"
struct GNUNET_TRANSPORT_Blacklist *br = cls;
struct GNUNET_MessageHeader req;
+ br->th = NULL;
if (buf == NULL)
{
reconnect (br);
req.size = htons (sizeof (struct GNUNET_MessageHeader));
req.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT);
memcpy (buf, &req, sizeof (req));
- br->th = NULL;
receive (br);
return sizeof (req);
}
reconnect (struct GNUNET_TRANSPORT_Blacklist *br)
{
if (br->client != NULL)
- GNUNET_CLIENT_disconnect (br->client, GNUNET_NO);
+ GNUNET_CLIENT_disconnect (br->client);
br->client = GNUNET_CLIENT_connect ("transport", br->cfg);
GNUNET_assert (br->client != NULL);
br->th =
struct GNUNET_TRANSPORT_Blacklist *br = cls;
struct BlacklistMessage req;
+ br->th = NULL;
if (buf == NULL)
{
reconnect (br);
static void
reply (struct GNUNET_TRANSPORT_Blacklist *br)
{
+ GNUNET_assert (br->th == NULL);
br->th =
GNUNET_CLIENT_notify_transmit_ready (br->client,
sizeof (struct BlacklistMessage),
client = GNUNET_CLIENT_connect ("transport", cfg);
if (NULL == client)
return NULL;
- ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Blacklist));
+ ret = GNUNET_new (struct GNUNET_TRANSPORT_Blacklist);
ret->client = client;
ret->cfg = cfg;
ret->cb = cb;
ret->cb_cls = cb_cls;
+ GNUNET_assert (ret->th == NULL);
ret->th =
GNUNET_CLIENT_notify_transmit_ready (client,
sizeof (struct GNUNET_MessageHeader),
GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br)
{
if (br->th != NULL)
+ {
GNUNET_CLIENT_notify_transmit_ready_cancel (br->th);
- GNUNET_CLIENT_disconnect (br->client, GNUNET_NO);
+ br->th = NULL;
+ }
+ GNUNET_CLIENT_disconnect (br->client);
GNUNET_free (br);
}