[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32821 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32821 - gnunet/src/transport |
Date: |
Fri, 28 Mar 2014 14:06:44 +0100 |
Author: wachs
Date: 2014-03-28 14:06:44 +0100 (Fri, 28 Mar 2014)
New Revision: 32821
Modified:
gnunet/src/transport/gnunet-service-transport.c
Log:
re-add address on connect
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2014-03-28 12:42:39 UTC
(rev 32820)
+++ gnunet/src/transport/gnunet-service-transport.c 2014-03-28 13:06:44 UTC
(rev 32821)
@@ -358,6 +358,36 @@
}
/**
+ * Black list check result for try_connect call
+ * If connection to the peer is allowed request adddress and
+ *
+ * @param cls blc_ctx bl context
+ * @param peer the peer
+ * @param result the result
+ */
+static void
+connect_transport_bl_check_cont (void *cls,
+ const struct GNUNET_PeerIdentity *peer, int result)
+{
+ struct BlacklistCheckContext *blctx = cls;
+
+ GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, blctx);
+ blctx->blc = NULL;
+
+ if (GNUNET_OK == result)
+ {
+ /* Blacklist allows to speak to this transport */
+ GST_ats_add_address(blctx->address, blctx->session, blctx->ats,
blctx->ats_count);
+ }
+
+ if (NULL != blctx->address)
+ GNUNET_HELLO_address_free (blctx->address);
+ GNUNET_free (blctx->msg);
+ GNUNET_free (blctx);
+}
+
+
+/**
* Function called by the transport for each received message.
*
* @param cls closure, const char* with the name of the plugin we received the
message from
@@ -440,6 +470,18 @@
{
blctx->blc = blc;
}
+
+ blctx = GNUNET_new (struct BlacklistCheckContext);
+ blctx->address = GNUNET_HELLO_address_copy (address);
+ blctx->session = session;
+ blctx->msg = GNUNET_malloc (ntohs(message->size));
+ memcpy (blctx->msg, message, ntohs(message->size));
+ GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, blctx);
+ if (NULL != (blc = GST_blacklist_test_allowed (&address->peer,
+ address->transport_name, &connect_transport_bl_check_cont, blctx)))
+ {
+ blctx->blc = blc;
+ }
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT_ACK:
if (GNUNET_OK != GST_neighbours_handle_connect_ack (message,
@@ -650,10 +692,10 @@
ats2[0].value = htonl (net);
memcpy (&ats2[1], ats, sizeof(struct GNUNET_ATS_Information) * ats_count);
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "Notifying ATS about peer `%s''s new address `%s' session %p in network
%s %u\n",
+ "Notifying ATS about peer `%s''s new address `%s' session %p in network
%s\n",
GNUNET_i2s (&address->peer),
(0 == address->address_length) ? "<inbound>" : GST_plugins_a2s (address),
- session, GNUNET_ATS_print_network_type (net), net);
+ session, GNUNET_ATS_print_network_type (net));
GNUNET_ATS_address_add (GST_ats, address, session, ats2, ats_count + 1);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32821 - gnunet/src/transport,
gnunet <=