summaryrefslogtreecommitdiff
path: root/src/transport/transport_api_blacklist.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-01 17:08:21 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-01 17:08:21 +0000
commit67f3331b28aee547a80a972099c85e91cb3d5382 (patch)
treeeb8bf6892b1943219a3c38876fcac9ba5ec1a0ed /src/transport/transport_api_blacklist.c
parent45071615217cedd90eaaaeb4f70712cb84427ece (diff)
fixing and testing blacklisting api and service
Diffstat (limited to 'src/transport/transport_api_blacklist.c')
-rw-r--r--src/transport/transport_api_blacklist.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c
index b1c536a9d..be52623bb 100644
--- a/src/transport/transport_api_blacklist.c
+++ b/src/transport/transport_api_blacklist.c
@@ -145,6 +145,7 @@ transmit_blacklist_init (void *cls, size_t size, void *buf)
struct GNUNET_TRANSPORT_Blacklist *br = cls;
struct GNUNET_MessageHeader req;
+ br->th = NULL;
if (buf == NULL)
{
reconnect (br);
@@ -153,7 +154,6 @@ transmit_blacklist_init (void *cls, size_t size, void *buf)
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);
}
@@ -194,6 +194,7 @@ transmit_blacklist_reply (void *cls, size_t size, void *buf)
struct GNUNET_TRANSPORT_Blacklist *br = cls;
struct BlacklistMessage req;
+ br->th = NULL;
if (buf == NULL)
{
reconnect (br);
@@ -218,6 +219,7 @@ transmit_blacklist_reply (void *cls, size_t size, void *buf)
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),
@@ -261,6 +263,7 @@ GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg,
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),
@@ -281,7 +284,10 @@ void
GNUNET_TRANSPORT_blacklist_cancel (struct GNUNET_TRANSPORT_Blacklist *br)
{
if (br->th != NULL)
+ {
GNUNET_CLIENT_notify_transmit_ready_cancel (br->th);
+ br->th = NULL;
+ }
GNUNET_CLIENT_disconnect (br->client, GNUNET_NO);
GNUNET_free (br);
}