summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/.gitignore1
-rw-r--r--src/transport/Makefile.am77
-rw-r--r--src/transport/gnunet-communicator-tcp.c37
-rw-r--r--src/transport/gnunet-communicator-udp.c19
-rw-r--r--src/transport/gnunet-service-tng.c597
-rw-r--r--src/transport/gnunet-service-transport.c14
-rw-r--r--src/transport/gnunet-service-transport_ats.c14
-rw-r--r--src/transport/gnunet-service-transport_ats.h3
-rw-r--r--src/transport/gnunet-service-transport_hello.c10
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c4
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c24
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h2
-rw-r--r--src/transport/gnunet-service-transport_plugins.c19
-rw-r--r--src/transport/gnunet-service-transport_plugins.h4
-rw-r--r--src/transport/plugin_transport_http_client.c12
-rw-r--r--src/transport/plugin_transport_http_common.c45
-rw-r--r--src/transport/plugin_transport_http_common.h6
-rw-r--r--src/transport/plugin_transport_http_server.c2
-rw-r--r--src/transport/plugin_transport_tcp.c2
-rw-r--r--src/transport/plugin_transport_udp.c2
-rw-r--r--src/transport/tcp_server_legacy.c20
-rw-r--r--src/transport/test_transport_api2_tcp_node1.conf6
-rw-r--r--src/transport/test_transport_api2_tcp_node2.conf4
-rw-r--r--src/transport/test_transport_api2_tcp_peer1.conf4
-rw-r--r--src/transport/test_transport_api2_tcp_peer2.conf4
-rw-r--r--src/transport/test_transport_distance_vector_circle_topo.conf1
-rw-r--r--src/transport/test_transport_distance_vector_inverse_topo.conf13
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c69
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_broadcast.c70
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_dv.c73
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c77
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_circle.sh1
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_inverse.sh11
-rw-r--r--src/transport/transport-testing-cmds.h10
-rw-r--r--src/transport/transport-testing-communicator.c15
-rw-r--r--src/transport/transport-testing-filenames.c28
-rw-r--r--src/transport/transport-testing-main.c2
-rw-r--r--src/transport/transport-testing-main2.c2
-rw-r--r--src/transport/transport-testing2.c33
-rw-r--r--src/transport/transport-testing2.h2
-rw-r--r--src/transport/transport.h5
-rw-r--r--src/transport/transport_api2_communication.c105
-rw-r--r--src/transport/transport_api_address_to_string.c4
-rw-r--r--src/transport/transport_api_cmd_backchannel_check.c64
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c35
-rw-r--r--src/transport/transport_api_cmd_send_simple.c52
-rw-r--r--src/transport/transport_api_cmd_start_peer.c11
-rw-r--r--src/transport/transport_api_core.c2
-rw-r--r--src/transport/transport_api_monitor_peers.c26
-rw-r--r--src/transport/transport_api_monitor_plugins.c4
-rw-r--r--src/transport/transport_api_offer_hello.c5
51 files changed, 760 insertions, 892 deletions
diff --git a/src/transport/.gitignore b/src/transport/.gitignore
index c9a208f5e..5a82a787b 100644
--- a/src/transport/.gitignore
+++ b/src/transport/.gitignore
@@ -90,3 +90,4 @@ gnunet-communicator-udp
test_communicator_unix
test_communicator_basic_unix
test_transport_start_with_config
+test_transport_api2_tcp
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 7bd07b905..363f8b199 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -16,63 +16,28 @@ HTTPS_SERVER_PLUGIN_LA = libgnunet_plugin_transport_https_server.la
HTTP_SERVER_PLUGIN_TEST = test_plugin_http_server
HTTPS_SERVER_PLUGIN_TEST = test_plugin_https_server
-if HAVE_LIBGNURL
- HTTP_CLIENT_PLUGIN_TEST = test_plugin_http_client
- HTTPS_CLIENT_PLUGIN_TEST = test_plugin_https_client
- HTTP_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_http_client.la
- HTTPS_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_https_client.la
-LIB_GNURL=@LIBGNURL@
-CPP_GNURL=@LIBGNURL_CPPFLAGS@
-else
-if HAVE_LIBCURL
- HTTP_CLIENT_PLUGIN_TEST = test_plugin_http_client
- HTTPS_CLIENT_PLUGIN_TEST = test_plugin_https_client
- HTTP_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_http_client.la
- HTTPS_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_https_client.la
-LIB_GNURL=@LIBCURL@
-CPP_GNURL=@LIBCURL_CPPFLAGS@
-endif
-endif
-
-if HAVE_LIBGNURL
- HTTP_API_TEST = test_transport_api_http
- HTTP_REVERSE_API_TEST = test_transport_api_http_reverse
- HTTP_API_TIMEOUT_TEST = test_transport_api_timeout_http
- HTTP_REL_TEST = test_transport_api_reliability_http \
- test_transport_api_reliability_http_xhr
- HTTP_QUOTA_TEST = test_quota_compliance_http \
- test_quota_compliance_http_asymmetric
- HTTP_SWITCH = test_transport_address_switch_http
- HTTPS_API_TEST = test_transport_api_https
- HTTPS_API_TIMEOUT_TEST = test_transport_api_timeout_https
-if HAVE_EXPERIMENTAL
- HTTPS_REL_TEST = test_transport_api_reliability_https \
- test_transport_api_reliability_https_xhr
-endif
- HTTPS_QUOTA_TEST = test_quota_compliance_https \
- test_quota_compliance_https_asymmetric
- HTTPS_SWITCH = test_transport_address_switch_https
-else
-if HAVE_LIBCURL
- HTTP_API_TEST = test_transport_api_http
- HTTP_REVERSE_API_TEST = test_transport_api_http_reverse
- HTTP_API_TIMEOUT_TEST = test_transport_api_timeout_http
- HTTP_REL_TEST = test_transport_api_reliability_http \
+HTTP_CLIENT_PLUGIN_TEST = test_plugin_http_client
+HTTPS_CLIENT_PLUGIN_TEST = test_plugin_https_client
+HTTP_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_http_client.la
+HTTPS_CLIENT_PLUGIN_LA = libgnunet_plugin_transport_https_client.la
+
+HTTP_API_TEST = test_transport_api_http
+HTTP_REVERSE_API_TEST = test_transport_api_http_reverse
+HTTP_API_TIMEOUT_TEST = test_transport_api_timeout_http
+HTTP_REL_TEST = test_transport_api_reliability_http \
test_transport_api_reliability_http_xhr
- HTTP_QUOTA_TEST = test_quota_compliance_http \
+HTTP_QUOTA_TEST = test_quota_compliance_http \
test_quota_compliance_http_asymmetric
- HTTP_SWITCH = test_transport_address_switch_http
- HTTPS_API_TEST = test_transport_api_https
- HTTPS_API_TIMEOUT_TEST = test_transport_api_timeout_https
+HTTP_SWITCH = test_transport_address_switch_http
+HTTPS_API_TEST = test_transport_api_https
+HTTPS_API_TIMEOUT_TEST = test_transport_api_timeout_https
if HAVE_EXPERIMENTAL
HTTPS_REL_TEST = test_transport_api_reliability_https \
test_transport_api_reliability_https_xhr
endif
- HTTPS_QUOTA_TEST = test_quota_compliance_https \
+HTTPS_QUOTA_TEST = test_quota_compliance_https \
test_quota_compliance_https_asymmetric
- HTTPS_SWITCH = test_transport_address_switch_https
-endif
-endif
+HTTPS_SWITCH = test_transport_address_switch_https
if USE_COVERAGE
AM_CFLAGS = --coverage -O0
@@ -555,13 +520,13 @@ libgnunet_plugin_transport_http_client_la_LIBADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
- $(LIB_GNURL) \
+ @LIBCURL@ \
$(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_transport_http_client_la_LDFLAGS = \
$(GN_LIBINTL) \
$(GN_PLUGIN_LDFLAGS)
libgnunet_plugin_transport_http_client_la_CFLAGS = \
- $(CPP_GNURL) $(AM_CFLAGS)
+ @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
libgnunet_plugin_transport_http_server_la_SOURCES = \
@@ -585,13 +550,13 @@ libgnunet_plugin_transport_https_client_la_LIBADD = \
$(top_builddir)/src/hello/libgnunethello.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
- $(LIB_GNURL) \
+ @LIBCURL@ \
$(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_transport_https_client_la_LDFLAGS = \
$(GN_LIBINTL) \
$(GN_PLUGIN_LDFLAGS)
libgnunet_plugin_transport_https_client_la_CFLAGS = \
- $(CPP_GNURL) $(AM_CFLAGS) -DBUILD_HTTPS
+ @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) -DBUILD_HTTPS
libgnunet_plugin_transport_https_server_la_SOURCES = \
@@ -781,8 +746,8 @@ check_SCRIPTS= \
test_transport_simple_send.sh \
test_transport_simple_send_broadcast.sh \
test_transport_udp_backchannel.sh \
- test_transport_simple_send_dv_circle.sh
- # test_transport_simple_send_dv_inverse.sh
+ test_transport_simple_send_dv_circle.sh \
+ test_transport_simple_send_dv_inverse.sh
endif
test_transport_start_with_config_SOURCES = \
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index 6d7a151ec..a8dbed604 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -981,7 +981,7 @@ queue_destroy (struct Queue *queue)
* @param[in,out] hmac_secret secret for HMAC calculation
* @param buf buffer to MAC
* @param buf_size number of bytes in @a buf
- * @param smac[out] where to write the HMAC
+ * @param[out] smac where to write the HMAC
*/
static void
calculate_hmac (struct GNUNET_HashCode *hmac_secret,
@@ -1155,8 +1155,8 @@ pass_plaintext_to_core (struct Queue *queue,
*
* @param dh shared secret
* @param pid decrypting peer's identity
- * @param cipher[out] cipher to initialize
- * @param hmac_key[out] HMAC key to initialize
+ * @param[out] cipher cipher to initialize
+ * @param[out] hmac_key HMAC key to initialize
*/
static void
setup_cipher (const struct GNUNET_HashCode *dh,
@@ -1287,7 +1287,7 @@ rekey_monotime_cb (void *cls,
* Setup cipher of @a queue for decryption.
*
* @param ephemeral ephemeral key we received from the other peer
- * @param queue[in,out] queue to initialize decryption cipher for
+ * @param[in,out] queue queue to initialize decryption cipher for
*/
static void
setup_in_cipher (const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral,
@@ -1448,8 +1448,8 @@ handshake_ack_monotime_cb (void *cls,
* @param queue The queue context.
*/
static void
-send_challenge (struct GNUNET_CRYPTO_ChallengeNonceP challenge, struct
- Queue *queue)
+send_challenge (struct GNUNET_CRYPTO_ChallengeNonceP challenge,
+ struct Queue *queue)
{
struct TCPConfirmationAck tca;
struct TcpHandshakeAckSignature thas;
@@ -1607,7 +1607,11 @@ queue_write (void *cls)
}
/* can we encrypt more? (always encrypt full messages, needed
such that #mq_cancel() can work!) */
- if ((0 < queue->rekey_left_bytes) &&
+ unsigned int we_do_not_need_to_rekey = (0 < queue->rekey_left_bytes
+ - (queue->cwrite_off
+ + queue->pwrite_off
+ + sizeof (struct TCPRekey)));
+ if (we_do_not_need_to_rekey &&
(queue->pwrite_off > 0) &&
(queue->cwrite_off + queue->pwrite_off <= BUF_SIZE))
{
@@ -1627,11 +1631,11 @@ queue_write (void *cls)
queue->pwrite_off = 0;
}
// if ((-1 != unverified_size)&& ((0 == queue->pwrite_off) &&
- if (((0 == queue->pwrite_off) &&
- ((0 == queue->rekey_left_bytes) ||
- (0 ==
- GNUNET_TIME_absolute_get_remaining (
- queue->rekey_time).rel_value_us))))
+ if (((0 == queue->rekey_left_bytes) ||
+ (0 == GNUNET_TIME_absolute_get_remaining (
+ queue->rekey_time).rel_value_us)) &&
+ (((0 == queue->pwrite_off) || ! we_do_not_need_to_rekey)&&
+ (queue->cwrite_off + sizeof (struct TCPRekey) <= BUF_SIZE)))
{
inject_rekey (queue);
}
@@ -2274,8 +2278,9 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
struct sockaddr_in6 v6;
char *start;
+ memset (&v4, 0, sizeof(v4));
start = extract_address (bindto);
- // FIXME: check NULL == start
+ GNUNET_assert (NULL != start);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"start %s\n",
start);
@@ -2608,7 +2613,7 @@ handshake_monotime_cb (void *cls,
* Note that #setup_in_cipher() must have already been called.
*
* @param queue queue to decrypt initial bytes from other peer for
- * @param tc[out] where to store the result
+ * @param[out] tc where to store the result
* @param ibuf incoming data, of size
* `INITIAL_KX_SIZE`
* @return #GNUNET_OK if the signature was OK, #GNUNET_SYSERR if not
@@ -3174,7 +3179,7 @@ enc_notify_cb (void *cls,
* a function to call whenever our set of 'valid' addresses changes.
*
* @param cls closure
- * @param app_ctx[in,out] location where the app can store stuff
+ * @param[in,out] app_ctx location where the app can store stuff
* on add and retrieve it on remove
* @param add_remove #GNUNET_YES to add a new public IP address,
* #GNUNET_NO to remove a previous (now invalid) one
@@ -3549,6 +3554,8 @@ run (void *cls,
socklen_t addr_len_ipv6;
(void) cls;
+ memset (&v4,0,sizeof(struct sockaddr_in));
+ memset (&v6,0,sizeof(struct sockaddr_in6));
cfg = c;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index 70848ff79..282902f1c 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -998,7 +998,7 @@ kce_destroy (struct KeyCacheEntry *kce)
*
* @param msec master secret for HMAC calculation
* @param serial number for the @a smac calculation
- * @param kid[out] where to write the key ID
+ * @param[out] kid where to write the key ID
*/
static void
get_kid (const struct GNUNET_HashCode *msec,
@@ -1130,8 +1130,8 @@ sender_destroy (struct SenderAddress *sender)
*
* @param msec master secret for calculation
* @param serial number for the @a smac calculation
- * @param key[out] where to write the decryption key
- * @param iv[out] where to write the IV
+ * @param[out] key where to write the decryption key
+ * @param[out] iv where to write the IV
*/
static void
get_iv_key (const struct GNUNET_HashCode *msec,
@@ -1237,7 +1237,7 @@ check_timeouts (void *cls)
/**
* Calculate cmac from master in @a ss.
*
- * @param ss[in,out] data structure to complete
+ * @param[in,out] ss data structure to complete
*/
static void
calculate_cmac (struct SharedSecret *ss)
@@ -1397,7 +1397,7 @@ setup_shared_secret_dec (const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral)
* Setup shared secret for encryption.
*
* @param ephemeral ephemeral key we are sending to the other peer
- * @param receiver[in,out] queue to initialize encryption key for
+ * @param[in,out] receiver queue to initialize encryption key for
* @return new shared secret
*/
static struct SharedSecret *
@@ -1723,7 +1723,7 @@ try_handle_plaintext (struct SenderAddress *sender,
uint16_t type;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "try_handle_plaintext of size %u (%u %u) and type %u\n",
+ "try_handle_plaintext of size %lu (%u %lu) and type %u\n",
buf_size,
ntohs (hdr->size),
sizeof(*hdr),
@@ -2198,7 +2198,7 @@ setup_sender (const struct GNUNET_PeerIdentity *target,
/**
* Check signature from @a uc against @a ephemeral.
*
- * @param ephermal key that is signed
+ * @param ephemeral key that is signed
* @param uc signature of claimant
* @return #GNUNET_OK if signature is valid
*/
@@ -2367,6 +2367,7 @@ sock_read (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received our own broadcast\n");
+ GNUNET_free (addr_verify);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2394,6 +2395,7 @@ sock_read (void *cls)
GNUNET_i2s (&sender));
GNUNET_TRANSPORT_application_validate (ah, &sender, nt, addr_s);
GNUNET_free (addr_s);
+ GNUNET_free (addr_verify);
return;
}
else
@@ -2589,6 +2591,8 @@ udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
{
/* try IPv4 */
struct sockaddr_in v4;
+
+ memset (&v4, 0, sizeof(v4));
if (1 == inet_pton (AF_INET, cp, &v4.sin_addr))
{
v4.sin_family = AF_INET;
@@ -2607,6 +2611,7 @@ udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
struct sockaddr_in6 v6;
const char *start;
+ memset (&v6, 0, sizeof(v6));
start = cp;
if (('[' == *cp) && (']' == cp[strlen (cp) - 1]))
{
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 7efe07fda..5976bd5b1 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -82,6 +82,11 @@
#include "transport.h"
/**
+ * Size of ring buffer to cache CORE and forwarded DVBox messages.
+ */
+#define RING_BUFFER_SIZE 16
+
+/**
* Maximum number of FC retransmissions for a running retransmission task.
*/
#define MAX_FC_RETRANSMIT_COUNT 1000
@@ -1181,6 +1186,11 @@ struct CommunicatorMessageContext
struct GNUNET_TRANSPORT_IncomingMessage im;
/**
+ * The message to demultiplex.
+ */
+ const struct GNUNET_MessageHeader *mh;
+
+ /**
* Number of hops the message has travelled (if DV-routed).
* FIXME: make use of this in ACK handling!
*/
@@ -1189,6 +1199,23 @@ struct CommunicatorMessageContext
/**
+ * Entry for the ring buffer caching messages send to core, when virtual link is avaliable.
+ **/
+struct RingBufferEntry
+{
+ /**
+ * Communicator context for this ring buffer entry.
+ **/
+ struct CommunicatorMessageContext *cmc;
+
+ /**
+ * The message in this entry.
+ **/
+ struct GNUNET_MessageHeader *mh;
+};
+
+
+/**
* Closure for #core_env_sent_cb.
*/
struct CoreSentContext
@@ -2165,10 +2192,16 @@ struct PendingMessage
/**
* Target of the request (always the ultimate destination!).
+ * Might be NULL in case of a forwarded DVBox we have no validated neighbour.
*/
struct VirtualLink *vl;
/**
+ * In case of a not validated neighbour, we store the target peer.
+ **/
+ struct GNUNET_PeerIdentity target;
+
+ /**
* Set to non-NULL value if this message is currently being given to a
* communicator and we are awaiting that communicator's acknowledgement.
* Note that we must not retransmit a pending message while we're still
@@ -2666,6 +2699,36 @@ struct Backtalker
/**
+ * Ring buffer for a CORE message we did not deliver to CORE, because of missing virtual link to sender.
+ */
+static struct RingBufferEntry *ring_buffer[RING_BUFFER_SIZE];
+
+/**
+ * Head of the ring buffer.
+ */
+static unsigned int ring_buffer_head;
+
+/**
+ * Is the ring buffer filled up to RING_BUFFER_SIZE.
+ */
+static unsigned int is_ring_buffer_full;
+
+/**
+ * Ring buffer for a forwarded DVBox message we did not deliver to the next hop, because of missing virtual link that hop.
+ */
+static struct PendingMessage *ring_buffer_dv[RING_BUFFER_SIZE];
+
+/**
+ * Head of the ring buffer.
+ */
+static unsigned int ring_buffer_dv_head;
+
+/**
+ * Is the ring buffer filled up to RING_BUFFER_SIZE.
+ */
+static unsigned int is_ring_buffer_dv_full;
+
+/**
* Head of linked list of all clients to this service.
*/
static struct TransportClient *clients_head;
@@ -2775,18 +2838,6 @@ static struct GNUNET_SCHEDULER_Task *dvlearn_task;
static struct GNUNET_SCHEDULER_Task *validation_task;
/**
- * The most recent PA we have created, head of DLL.
- * The length of the DLL is kept in #pa_count.
- */
-static struct PendingAcknowledgement *pa_head;
-
-/**
- * The oldest PA we have created, tail of DLL.
- * The length of the DLL is kept in #pa_count.
- */
-static struct PendingAcknowledgement *pa_tail;
-
-/**
* List of incoming connections where we are trying
* to get a connection back established. Length
* kept in #ir_total.
@@ -2809,12 +2860,6 @@ static unsigned int ir_total;
static unsigned long long logging_uuid_gen;
/**
- * Number of entries in the #pa_head/#pa_tail DLL. Used to
- * limit the size of the data structure.
- */
-static unsigned int pa_count;
-
-/**
* Monotonic time we use for HELLOs generated at this time. TODO: we
* should increase this value from time to time (i.e. whenever a
* `struct AddressListEntry` actually expires), but IF we do this, we
@@ -2946,8 +2991,9 @@ free_fragment_tree (struct PendingMessage *root)
GNUNET_CONTAINER_DLL_remove (frag->qe->queue->queue_head,
frag->qe->queue->queue_tail,
frag->qe);
+ frag->qe->queue->queue_length--;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing QueueEntry MID %llu from queue\n",
+ "Removing QueueEntry MID %lu from queue\n",
frag->qe->mid);
GNUNET_free (frag->qe);
}
@@ -2986,7 +3032,7 @@ free_pending_message (struct PendingMessage *pm)
if ((NULL != vl) && (NULL == pm->frag_parent))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing pm %lu\n",
+ "Removing pm %llu\n",
pm->logging_uuid);
GNUNET_CONTAINER_MDLL_remove (vl,
vl->pending_msg_head,
@@ -3019,20 +3065,23 @@ free_pending_message (struct PendingMessage *pm)
GNUNET_CONTAINER_DLL_remove (pm->qe->queue->queue_head,
pm->qe->queue->queue_tail,
pm->qe);
+ pm->qe->queue->queue_length--;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing QueueEntry MID %llu from queue\n",
+ "Removing QueueEntry MID %lu from queue\n",
pm->qe->mid);
GNUNET_free (pm->qe);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "QueueEntry MID freed\n");
}
if (NULL != pm->bpm)
{
free_fragment_tree (pm->bpm);
GNUNET_free (pm->bpm);
}
- if (NULL == pm)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "free pending pm null\n");
+
GNUNET_free (pm);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Freeing pm done\n");
}
@@ -3247,7 +3296,7 @@ struct MonitorEvent
/**
- * Free a @dvh. Callers MAY want to check if this was the last path to the
+ * Free a @a dvh. Callers MAY want to check if this was the last path to the
* `target`, and if so call #free_dv_route to also free the associated DV
* entry in #dv_routes (if not, the associated scheduler job should eventually
* take care of it).
@@ -3752,6 +3801,9 @@ free_queue (struct Queue *queue)
maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <=
tc->details.communicator.
total_queue_length);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cleaning up queue with length %u\n",
+ queue->queue_length);
while (NULL != (qe = queue->queue_head))
{
GNUNET_CONTAINER_DLL_remove (queue->queue_head, queue->queue_tail, qe);
@@ -3764,6 +3816,9 @@ free_queue (struct Queue *queue)
}
GNUNET_free (qe);
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cleaning up queue with length %u\n",
+ queue->queue_length);
GNUNET_assert (0 == queue->queue_length);
if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT >
tc->details.communicator.total_queue_length))
@@ -3784,7 +3839,7 @@ free_queue (struct Queue *queue)
GNUNET_free (queue);
vl = lookup_virtual_link (&neighbour->pid);
- if ((NULL != vl) && (GNUNET_YES == vl->confirmed) && (neighbour == vl->n))
+ if ((NULL != vl) && (neighbour == vl->n))
{
GNUNET_SCHEDULER_cancel (vl->visibility_task);
check_link_down (vl);
@@ -4081,7 +4136,7 @@ client_send_response (struct PendingMessage *pm)
*
* @param dv data structure to pick paths from
* @param options constraints to satisfy
- * @param hops_array[out] set to the result
+ * @param[out] hops_array set to the result
* @param hops_array_length length of the @a hops_array
* @return number of entries set in @a hops_array
*/
@@ -4189,7 +4244,9 @@ check_communicator_available (
* @param cmc context for which we are done handling the message
*/
static void
-finish_cmc_handling (struct CommunicatorMessageContext *cmc)
+finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc,
+ unsigned
+ int continue_client)
{
if (0 != ntohl (cmc->im.fc_on))
{
@@ -4197,17 +4254,31 @@ finish_cmc_handling (struct CommunicatorMessageContext *cmc)
struct GNUNET_MQ_Envelope *env;
struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Acknowledge message with flow control id %lu\n",
+ cmc->im.fc_id);
env = GNUNET_MQ_msg (ack, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK);
ack->reserved = htonl (0);
ack->fc_id = cmc->im.fc_id;
- ack->sender = cmc->im.sender;
+ ack->sender = cmc->im.neighbour_sender;
GNUNET_MQ_send (cmc->tc->mq, env);
}
- GNUNET_SERVICE_client_continue (cmc->tc->client);
+
+ if (GNUNET_YES == continue_client)
+ {
+ GNUNET_SERVICE_client_continue (cmc->tc->client);
+ }
GNUNET_free (cmc);
}
+static void
+finish_cmc_handling (struct CommunicatorMessageContext *cmc)
+{
+ finish_cmc_handling_with_continue (cmc, GNUNET_YES);
+}
+
+
/**
* Client confirms that it is done handling message(s) to a particular
* peer. We may now provide more messages to CORE for this peer.
@@ -4243,6 +4314,9 @@ handle_client_recv_ok (void *cls, const struct RecvOkMessage *rom)
}
delta = ntohl (rom->increase_window_delta);
vl->core_recv_window += delta;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "CORE ack receiving message, increased CORE recv window to %u\n",
+ vl->core_recv_window);
if (vl->core_recv_window <= 0)
return;
/* resume communicators */
@@ -4251,6 +4325,7 @@ handle_client_recv_ok (void *cls, const struct RecvOkMessage *rom)
GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc);
finish_cmc_handling (cmc);
}
+ GNUNET_SERVICE_client_continue (tc->client);
}
@@ -4329,7 +4404,7 @@ check_communicator_backchannel (
* Ensure ephemeral keys in our @a dv are current. If no current one exists,
* set it up.
*
- * @param dv[in,out] virtual link to update ephemeral for
+ * @param[in,out] dv virtual link to update ephemeral for
*/
static void
update_ephemeral (struct DistanceVector *dv)
@@ -4400,14 +4475,14 @@ queue_send_msg (struct Queue *queue,
qe->pm = pm;
// TODO Why do we have a retransmission. When we know, make decision if we still want this.
// GNUNET_assert (NULL == pm->qe);
- /*if (NULL != pm->qe)
+ if (NULL != pm->qe)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Retransmitting message <%llu> remove pm from qe with MID: %llu \n",
pm->logging_uuid,
(unsigned long long) pm->qe->mid);
- pm->qe->pm = NULL;
- }*/
+ // pm->qe->pm = NULL;
+ }
pm->qe = qe;
}
GNUNET_CONTAINER_DLL_insert (queue->queue_head, queue->queue_tail, qe);
@@ -4431,7 +4506,7 @@ queue_send_msg (struct Queue *queue,
if (0 == queue->q_capacity)
queue->idle = GNUNET_NO;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending message MID %llu of type %u (%u) and size %u with MQ %p\n",
+ "Sending message MID %lu of type %u (%u) and size %lu with MQ %p\n",
smt->mid,
ntohs (((const struct GNUNET_MessageHeader *) payload)->type),
ntohs (smt->header.size),
@@ -4562,7 +4637,7 @@ struct DVKeyState
*
* @param km raw master secret
* @param iv initialization vector
- * @param key[out] symmetric cipher and HMAC state to generate
+ * @param[out] key symmetric cipher and HMAC state to generate
*/
static void
dv_setup_key_state_from_km (const struct GNUNET_HashCode *km,
@@ -4604,7 +4679,7 @@ dv_setup_key_state_from_km (const struct GNUNET_HashCode *km,
* @param priv_ephemeral ephemeral private key to use
* @param target the target peer to encrypt to
* @param iv unique IV to use
- * @param key[out] set to the key material
+ * @param[out] key set to the key material
*/
static void
dh_key_derive_eph_pid (
@@ -4629,7 +4704,7 @@ dh_key_derive_eph_pid (
* @param priv_ephemeral ephemeral private key to use
* @param target the target peer to encrypt to
* @param iv unique IV to use
- * @param key[out] set to the key material
+ * @param[out] key set to the key material
*/
static void
dh_key_derive_eph_pub (const struct GNUNET_CRYPTO_EcdhePublicKey *pub_ephemeral,
@@ -4650,7 +4725,7 @@ dh_key_derive_eph_pub (const struct GNUNET_CRYPTO_EcdhePublicKey *pub_ephemeral,
* material from @a key.
*
* @param key key material (from DH)
- * @param hmac[out] set to the HMAC
+ * @param[out] hmac set to the HMAC
* @param data data to perform HMAC calculation over
* @param data_size number of bytes in @a data
*/
@@ -4668,7 +4743,7 @@ dv_hmac (const struct DVKeyState *key,
* Perform backchannel encryption using symmetric secret in @a key
* to encrypt data from @a in to @a dst.
*
- * @param key[in,out] key material to use
+ * @param[in,out] key key material to use
* @param dst where to write the result
* @param in input data to encrypt (plaintext)
* @param in_size number of bytes of input in @a in and available at @a dst
@@ -4685,9 +4760,9 @@ dv_encrypt (struct DVKeyState *key, const void *in, void *dst, size_t in_size)
* Perform backchannel encryption using symmetric secret in @a key
* to encrypt data from @a in to @a dst.
*
- * @param key[in,out] key material to use
+ * @param[in,out] key key material to use
* @param ciph cipher text to decrypt
- * @param out[out] output data to generate (plaintext)
+ * @param[out] out output data to generate (plaintext)
* @param out_size number of bytes of input in @a ciph and available in @a out
*/
static void
@@ -4740,7 +4815,7 @@ typedef void (*DVMessageHandler) (void *cls,
* @param use function to call with the encapsulated message
* @param use_cls closure for @a use
* @param options whether path must be confirmed or not, to be passed to @a use
- * @param shall this TransportDVBoxMessage be forwarded without flow control.
+ * @param without_fc shall this TransportDVBoxMessage be forwarded without flow control.
* @return expected RTT for transmission, #GNUNET_TIME_UNIT_FOREVER_REL if sending failed
*/
static struct GNUNET_TIME_Relative
@@ -5101,7 +5176,7 @@ check_vl_transmission (struct VirtualLink *vl)
vl->outbound_fc_window_size)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Stalled message %lu transmission on VL %s due to flow control: %llu < %llu\n",
+ "Stalled message %llu transmission on VL %s due to flow control: %llu < %llu\n",
pm->logging_uuid,
GNUNET_i2s (&vl->target),
(unsigned long long) vl->outbound_fc_window_size,
@@ -5154,11 +5229,12 @@ check_vl_transmission (struct VirtualLink *vl)
else
{
vl_next_hop = lookup_virtual_link (&nh->pid);
+ GNUNET_assert (NULL != vl_next_hop);
if (pm->bytes_msg + vl_next_hop->outbound_fc_window_size_used >
vl_next_hop->outbound_fc_window_size)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Stalled message %lu transmission on next hop %s due to flow control: %llu < %llu\n",
+ "Stalled message %llu transmission on next hop %s due to flow control: %llu < %llu\n",
pm->logging_uuid,
GNUNET_i2s (&vl_next_hop->target),
(unsigned long
@@ -5192,7 +5268,7 @@ check_vl_transmission (struct VirtualLink *vl)
}
if (GNUNET_YES == elig)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Eligible message %lu of size %llu to %s: %llu/%llu\n",
+ "Eligible message %llu of size %u to %s: %llu/%llu\n",
pm->logging_uuid,
pm->bytes_msg,
GNUNET_i2s (&vl->target),
@@ -5529,8 +5605,7 @@ handle_del_address (void *cls,
* @param msg message to demultiplex
*/
static void
-demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
- const struct GNUNET_MessageHeader *msg);
+demultiplex_with_cmc (struct CommunicatorMessageContext *cmc);
/**
@@ -5561,60 +5636,15 @@ core_env_sent_cb (void *cls)
}
-/**
- * Communicator gave us an unencapsulated message to pass as-is to
- * CORE. Process the request.
- *
- * @param cls a `struct CommunicatorMessageContext` (must call
- * #finish_cmc_handling() when done)
- * @param mh the message that was received
- */
static void
-handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
+finish_handling_raw_message (struct VirtualLink *vl,
+ const struct GNUNET_MessageHeader *mh,
+ struct CommunicatorMessageContext *cmc,
+ unsigned int continue_client)
{
- struct CommunicatorMessageContext *cmc = cls;
- struct VirtualLink *vl;
uint16_t size = ntohs (mh->size);
int have_core;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Handling raw message of type %u with %u bytes\n",
- (unsigned int) ntohs (mh->type),
- (unsigned int) ntohs (mh->size));
-
- if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
- (size < sizeof(struct GNUNET_MessageHeader)))
- {
- struct GNUNET_SERVICE_Client *client = cmc->tc->client;
-
- GNUNET_break (0);
- finish_cmc_handling (cmc);
- GNUNET_SERVICE_client_drop (client);
- return;
- }
- vl = lookup_virtual_link (&cmc->im.sender);
- if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
- {
- /* FIXME: sender is giving us messages for CORE but we don't have
- the link up yet! I *suspect* this can happen right now (i.e.
- sender has verified us, but we didn't verify sender), but if
- we pass this on, CORE would be confused (link down, messages
- arrive). We should investigate more if this happens often,
- or in a persistent manner, and possibly do "something" about
- it. Thus logging as error for now. */
- GNUNET_break_op (0);
- GNUNET_STATISTICS_update (GST_stats,
- "# CORE messages dropped (virtual link still down)",
- 1,
- GNUNET_NO);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "CORE messages of type %u with %u bytes dropped (virtual link still down)\n",
- (unsigned int) ntohs (mh->type),
- (unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
- return;
- }
if (vl->incoming_fc_window_size_ram > UINT_MAX - size)
{
GNUNET_STATISTICS_update (GST_stats,
@@ -5625,7 +5655,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
"CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n",
(unsigned int) ntohs (mh->type),
(unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
if (vl->incoming_fc_window_size_ram + size > vl->available_fc_window_size)
@@ -5638,7 +5668,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
"CORE messages of type %u with %u bytes dropped (FC window overflow)\n",
(unsigned int) ntohs (mh->type),
(unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
@@ -5678,16 +5708,17 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
"Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n",
(unsigned int) ntohs (mh->type),
(unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Delivered message from %s of type %u to CORE\n",
+ "Delivered message from %s of type %u to CORE recv window %u\n",
GNUNET_i2s (&cmc->im.sender),
- ntohs (mh->type));
+ ntohs (mh->type),
+ vl->core_recv_window);
if (vl->core_recv_window > 0)
{
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
/* Wait with calling #finish_cmc_handling(cmc) until the message
@@ -5696,6 +5727,100 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
}
+
+/**
+ * Communicator gave us an unencapsulated message to pass as-is to
+ * CORE. Process the request.
+ *
+ * @param cls a `struct CommunicatorMessageContext` (must call
+ * #finish_cmc_handling() when done)
+ * @param mh the message that was received
+ */
+static void
+handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
+{
+ struct CommunicatorMessageContext *cmc = cls;
+ // struct CommunicatorMessageContext *cmc_copy =
+ // GNUNET_new (struct CommunicatorMessageContext);
+ struct GNUNET_MessageHeader *mh_copy;
+ struct RingBufferEntry *rbe;
+ struct VirtualLink *vl;
+ uint16_t size = ntohs (mh->size);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Handling raw message of type %u with %u bytes\n",
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh->size));
+
+ if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
+ (size < sizeof(struct GNUNET_MessageHeader)))
+ {
+ struct GNUNET_SERVICE_Client *client = cmc->tc->client;
+
+ GNUNET_break (0);
+ finish_cmc_handling (cmc);
+ GNUNET_SERVICE_client_drop (client);
+ return;
+ }
+ vl = lookup_virtual_link (&cmc->im.sender);
+ if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
+ {
+ /* FIXME: sender is giving us messages for CORE but we don't have
+ the link up yet! I *suspect* this can happen right now (i.e.
+ sender has verified us, but we didn't verify sender), but if
+ we pass this on, CORE would be confused (link down, messages
+ arrive). We should investigate more if this happens often,
+ or in a persistent manner, and possibly do "something" about
+ it. Thus logging as error for now. */
+
+ mh_copy = GNUNET_malloc (size);
+ rbe = GNUNET_new (struct RingBufferEntry);
+ rbe->cmc = cmc;
+ /*cmc_copy->tc = cmc->tc;
+ cmc_copy->im = cmc->im;*/
+ GNUNET_memcpy (mh_copy, mh, size);
+
+ rbe->mh = mh_copy;
+
+ ring_buffer[ring_buffer_head] = rbe;// cmc_copy;
+ // cmc_copy->mh = (const struct GNUNET_MessageHeader *) mh_copy;
+ cmc->mh = (const struct GNUNET_MessageHeader *) mh_copy;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Storing message for %s and type %u (%u) in ring buffer\n",
+ GNUNET_i2s (&cmc->im.sender),
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh_copy->type));
+ if (RING_BUFFER_SIZE - 1 == ring_buffer_head)
+ {
+ ring_buffer_head = 0;
+ is_ring_buffer_full = GNUNET_YES;
+ }
+ else
+ ring_buffer_head++;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items stored in ring buffer\n",
+ ring_buffer_head);
+
+ /*GNUNET_break_op (0);
+ GNUNET_STATISTICS_update (GST_stats,
+ "# CORE messages dropped (virtual link still down)",
+ 1,
+ GNUNET_NO);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "CORE messages of type %u with %u bytes dropped (virtual link still down)\n",
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh->size));
+ finish_cmc_handling (cmc);*/
+ GNUNET_SERVICE_client_continue (cmc->tc->client);
+ // GNUNET_free (cmc);
+ return;
+ }
+ finish_handling_raw_message (vl, mh, cmc, GNUNET_YES);
+}
+
+
/**
* Communicator gave us a fragment box. Check the message.
*
@@ -6067,7 +6192,8 @@ handle_fragment_box (void *cls, const struct TransportFragmentBoxMessage *fb)
(unsigned int) fb->msg_uuid.uuid);
/* FIXME: check that the resulting msg is NOT a
DV Box or Reliability Box, as that is NOT allowed! */
- demultiplex_with_cmc (cmc, msg);
+ cmc->mh = msg;
+ demultiplex_with_cmc (cmc);
/* FIXME-OPTIMIZE: really free here? Might be bad if fragments are still
en-route and we forget that we finished this reassembly immediately!
-> keep around until timeout?
@@ -6092,7 +6218,7 @@ check_reliability_box (void *cls,
GNUNET_MessageHeader *) &rb[1];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "check_send_msg with size %u: inner msg type %u and size %u (%u %u)\n",
+ "check_send_msg with size %u: inner msg type %u and size %u (%lu %lu)\n",
ntohs (rb->header.size),
ntohs (inbox->type),
ntohs (inbox->size),
@@ -6138,7 +6264,8 @@ handle_reliability_box (void *cls,
/* continue with inner message */
/* FIXME: check that inbox is NOT a DV Box, fragment or another
reliability box (not allowed!) */
- demultiplex_with_cmc (cmc, inbox);
+ cmc->mh = inbox;
+ demultiplex_with_cmc (cmc);
}
@@ -6147,7 +6274,7 @@ handle_reliability_box (void *cls,
* so, purge ancient statistics (more than GOODPUT_AGING_SLOTS before
* the current age)
*
- * @param pd[in,out] data to update
+ * @param[in,out] pd data to update
* @param age current age
*/
static void
@@ -6173,7 +6300,7 @@ update_pd_age (struct PerformanceData *pd, unsigned int age)
* Update @a pd based on the latest @a rtt and the number of bytes
* that were confirmed to be successfully transmitted.
*
- * @param pd[in,out] data to update
+ * @param[in,out] pd data to update
* @param rtt latest round-trip time
* @param bytes_transmitted_ok number of bytes receiver confirmed as received
*/
@@ -6292,8 +6419,13 @@ completed_pending_message (struct PendingMessage *pm)
if (NULL != pm->bpm)
{
GNUNET_free (pm->bpm);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Freed bpm\n");
}
- client_send_response (pm->frag_parent);
+ pos = pm->frag_parent;
+ free_pending_message (pm);
+ pos->bpm = NULL;
+ client_send_response (pos);
}
else
client_send_response (pm);
@@ -6549,6 +6681,140 @@ path_cleanup_cb (void *cls)
}
+static void send_msg_from_cache (struct VirtualLink *vl)
+{
+
+ const struct GNUNET_PeerIdentity target = vl->target;
+
+
+ if ((GNUNET_YES == is_ring_buffer_full) || (0 < ring_buffer_head))
+ {
+ struct RingBufferEntry *ring_buffer_copy[RING_BUFFER_SIZE];
+ unsigned int tail = GNUNET_YES == is_ring_buffer_full ? ring_buffer_head :
+ 0;
+ unsigned int head = GNUNET_YES == is_ring_buffer_full ? RING_BUFFER_SIZE :
+ ring_buffer_head;
+ struct GNUNET_TRANSPORT_IncomingMessage im;
+ struct CommunicatorMessageContext *cmc;
+ struct RingBufferEntry *rbe;
+ struct GNUNET_MessageHeader *mh;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending from ring buffer, which has %u items\n",
+ ring_buffer_head);
+
+ ring_buffer_head = 0;
+ for (unsigned int i = 0; i < head; i++)
+ {
+ rbe = ring_buffer[(i + tail) % RING_BUFFER_SIZE];
+ cmc = rbe->cmc;
+ mh = rbe->mh;
+
+ im = cmc->im;
+ // mh = cmc->mh;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending to ring buffer target %s using vl target %s\n",
+ GNUNET_i2s (&im.sender),
+ GNUNET_i2s2 (&target));
+ if (0 == GNUNET_memcmp (&target, &im.sender))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Finish handling message of type %u and size %u\n",
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh->size));
+ finish_handling_raw_message (vl, mh, cmc, GNUNET_NO);
+ GNUNET_free (mh);
+ }
+ else
+ {
+ ring_buffer_copy[i] = rbe;
+ ring_buffer_head++;
+ }
+ }
+
+ if ((GNUNET_YES == is_ring_buffer_full) && (RING_BUFFER_SIZE - 1 >
+ ring_buffer_head))
+ {
+ is_ring_buffer_full = GNUNET_NO;
+ }
+
+ for (unsigned int i = 0; i < ring_buffer_head; i++)
+ {
+ ring_buffer[i] = ring_buffer_copy[i];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ring_buffer_copy[i]->mh->type for i %u %u\n",
+ i,
+ ring_buffer_copy[i]->mh->type);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ring_buffer[i]->mh->type for i %u %u\n",
+ i,
+ ring_buffer[i]->mh->type);
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items still in ring buffer\n",
+ ring_buffer_head);
+ }
+
+ if ((GNUNET_YES == is_ring_buffer_full) || (0 < ring_buffer_dv_head))
+ {
+ struct PendingMessage *ring_buffer_dv_copy[RING_BUFFER_SIZE];
+ struct PendingMessage *pm;
+ unsigned int tail = GNUNET_YES == is_ring_buffer_dv_full ?
+ ring_buffer_dv_head :
+ 0;
+ unsigned int head = GNUNET_YES == is_ring_buffer_dv_full ?
+ RING_BUFFER_SIZE :
+ ring_buffer_dv_head;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending from ring buffer dv, which has %u items\n",
+ ring_buffer_dv_head);
+
+ ring_buffer_dv_head = 0;
+ for (unsigned int i = 0; i < head; i++)
+ {
+ pm = ring_buffer_dv[(i + tail) % RING_BUFFER_SIZE];
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending to ring buffer target %s using vl target %s\n",
+ GNUNET_i2s (&pm->target),
+ GNUNET_i2s2 (&target));
+ if (0 == GNUNET_memcmp (&target, &pm->target))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding PendingMessage to vl, checking transmission.\n");
+ pm->vl = vl;
+ GNUNET_CONTAINER_MDLL_insert (vl,
+ vl->pending_msg_head,
+ vl->pending_msg_tail,
+ pm);
+
+ check_vl_transmission (vl);
+ }
+ else
+ {
+ ring_buffer_dv_copy[i] = pm;
+ ring_buffer_dv_head++;
+ }
+ }
+
+ if (is_ring_buffer_dv_full && (RING_BUFFER_SIZE - 1 > ring_buffer_dv_head))
+ {
+ is_ring_buffer_dv_full = GNUNET_NO;
+ }
+
+ for (unsigned int i = 0; i < ring_buffer_dv_head; i++)
+ ring_buffer_dv[i] = ring_buffer_dv_copy[i];
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items still in ring buffer dv.\n",
+ ring_buffer_dv_head);
+
+ }
+}
+
+
/**
* The @a hop is a validated path to the respective target
* peer and we should tell core about it -- and schedule
@@ -6592,6 +6858,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop)
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&dv->target);
+ send_msg_from_cache (vl);
}
else
{
@@ -6607,6 +6874,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop)
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&dv->target);
+ send_msg_from_cache (vl);
}
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7355,7 +7623,6 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
struct GNUNET_TIME_Relative host_latency_sum;
struct GNUNET_TIME_Relative latency;
struct GNUNET_TIME_Relative network_latency;
- struct GNUNET_TIME_Absolute now;
/* We initiated this, learn the forward path! */
path[0] = GST_my_identity;
@@ -7364,7 +7631,6 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
// Need also something to lookup initiation time
// to compute RTT! -> add RTT argument here?
- now = GNUNET_TIME_absolute_get ();
latency = GNUNET_TIME_absolute_get_duration (GNUNET_TIME_absolute_ntoh (
dvl->monotonic_time));
GNUNET_assert (latency.rel_value_us >= host_latency_sum.rel_value_us);
@@ -7426,7 +7692,8 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
iret = learn_dv_path (path,
i + 3,
GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_TIME_UNIT_ZERO_ABS);
+ GNUNET_TIME_relative_to_absolute (
+ ADDRESS_VALIDATION_LIFETIME));
if (GNUNET_SYSERR == iret)
{
/* path invalid or too long to be interesting for US, thus should also
@@ -7550,7 +7817,7 @@ check_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
/**
* Create a DV Box message and queue it for transmission to
- * @ea next_hop.
+ * @a next_hop.
*
* @param next_hop peer to receive the message next
* @param total_hops how many hops did the message take so far
@@ -7599,7 +7866,7 @@ forward_dv_box (struct Neighbour *next_hop,
GNUNET_MessageHeader *) msg_buf,
RMO_ANYTHING_GOES);
}
- else if (NULL != vl)
+ else
{
pm = GNUNET_malloc (sizeof(struct PendingMessage) + msg_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7608,29 +7875,48 @@ forward_dv_box (struct Neighbour *next_hop,
vl);
pm->pmt = PMT_DV_BOX;
pm->vl = vl;
+ pm->target = next_hop->pid;
pm->timeout = GNUNET_TIME_relative_to_absolute (DV_FORWARD_TIMEOUT);
pm->logging_uuid = logging_uuid_gen++;
pm->prefs = GNUNET_MQ_PRIO_BACKGROUND;
pm->bytes_msg = msg_size;
buf = (char *) &pm[1];
memcpy (buf, msg_buf, msg_size);
- GNUNET_CONTAINER_MDLL_insert (vl,
- vl->pending_msg_head,
- vl->pending_msg_tail,
- pm);
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created pending message %llu for DV Box with next hop %s (%u/%u)\n",
pm->logging_uuid,
GNUNET_i2s (&next_hop->pid),
(unsigned int) num_hops,
(unsigned int) total_hops);
- check_vl_transmission (vl);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "The virtual link is not ready for forwarding a DV Box with payload.\n");
- // FIXME The DV Box was send before the validation response. Shall we send a validation request for DV paths?
+
+ if ((NULL != vl) && (GNUNET_YES == vl->confirmed))
+ {
+ GNUNET_CONTAINER_MDLL_insert (vl,
+ vl->pending_msg_head,
+ vl->pending_msg_tail,
+ pm);
+
+ check_vl_transmission (vl);
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "The virtual link is not ready for forwarding a DV Box with payload, storing PendingMessage in ring buffer.\n");
+
+ ring_buffer_dv[ring_buffer_dv_head] = pm;
+ if (RING_BUFFER_SIZE - 1 == ring_buffer_dv_head)
+ {
+ ring_buffer_dv_head = 0;
+ is_ring_buffer_dv_full = GNUNET_YES;
+ }
+ else
+ ring_buffer_dv_head++;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items stored in DV ring buffer\n",
+ ring_buffer_dv_head);
+ }
}
}
@@ -7742,9 +8028,9 @@ backtalker_monotime_cb (void *cls,
continue normal processing */
b->get = NULL;
GNUNET_assert (NULL != b->cmc);
+ b->cmc->mh = (const struct GNUNET_MessageHeader *) &b[1];
if (0 != b->body_size)
- demultiplex_with_cmc (b->cmc,
- (const struct GNUNET_MessageHeader *) &b[1]);
+ demultiplex_with_cmc (b->cmc);
else
finish_cmc_handling (b->cmc);
b->cmc = NULL;
@@ -7862,7 +8148,6 @@ handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
const char *enc_payload = (const char *) &hops[num_hops];
uint16_t enc_payload_size =
size - (num_hops * sizeof(struct GNUNET_PeerIdentity));
- char enc[enc_payload_size];
struct DVKeyState *key;
struct GNUNET_HashCode hmac;
const char *hdr;
@@ -8050,8 +8335,8 @@ handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
update_backtalker_monotime (b);
b->timeout =
GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT);
-
- demultiplex_with_cmc (cmc, mh);
+ cmc->mh = mh;
+ demultiplex_with_cmc (cmc);
return;
}
/* setup data structure to cache signature AND check
@@ -8086,7 +8371,7 @@ handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
* Client notified us about transmission from a peer. Process the request.
*
* @param cls a `struct TransportClient` which sent us the message
- * @param obm the send message that was sent
+ * @param im the send message that was sent
* @return #GNUNET_YES if message is well-formed
*/
static int
@@ -8532,6 +8817,10 @@ handle_validation_response (
if ((origin_time.abs_value_us < vs->first_challenge_use.abs_value_us) ||
(origin_time.abs_value_us > vs->last_challenge_use.abs_value_us))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Diff first use %lu and last use %lu\n",
+ vs->first_challenge_use.abs_value_us - origin_time.abs_value_us,
+ origin_time.abs_value_us - vs->last_challenge_use.abs_value_us);
GNUNET_break_op (0);
finish_cmc_handling (cmc);
return;
@@ -8582,8 +8871,9 @@ handle_validation_response (
GNUNET_TIME_UNIT_ZERO_ABS; /* challenge was not yet used */
update_next_challenge_time (vs, vs->first_challenge_use);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Validation response %s accepted, address valid until %s\n",
+ "Validation response %s from %s accepted, address valid until %s\n",
GNUNET_sh2s (&tvr->challenge.value),
+ GNUNET_i2s (&cmc->im.sender),
GNUNET_STRINGS_absolute_time_to_string (vs->valid_until));
vs->sc = GNUNET_PEERSTORE_store (peerstore,
"transport",
@@ -8641,6 +8931,7 @@ handle_validation_response (
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&n->pid);
+ send_msg_from_cache (vl);
}
else
{
@@ -8651,7 +8942,7 @@ handle_validation_response (
n->vl = vl;
if (GNUNET_YES == vl->confirmed)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Virtual link to %s could now also direct neighbour!\n",
+ "Virtual link to %s could now also use direct neighbour!\n",
GNUNET_i2s (&vs->pid));
}
else
@@ -8668,6 +8959,7 @@ handle_validation_response (
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&n->pid);
+ send_msg_from_cache (vl);
}
}
}
@@ -8689,10 +8981,13 @@ handle_incoming_msg (void *cls,
cmc->tc = tc;
cmc->im = *im;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received message with size %u via communicator from peer %s\n",
- &im->header.size,
+ "Received message with size %u and flow control id %lu via communicator from peer %s\n",
+ ntohs (im->header.size),
+ im->fc_id,
GNUNET_i2s (&im->sender));
- demultiplex_with_cmc (cmc, (const struct GNUNET_MessageHeader *) &im[1]);
+ cmc->im.neighbour_sender = cmc->im.sender;
+ cmc->mh = (const struct GNUNET_MessageHeader *) &im[1];
+ demultiplex_with_cmc (cmc);
}
@@ -8780,7 +9075,7 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
% FC_NO_CHANGE_REPLY_PROBABILITY)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Consider re-sending our FC message, as clearly the other peer's idea of the window is not up-to-date (%llu vs %llu) or %llu last received differs, or random reply %lu\n",
+ "Consider re-sending our FC message, as clearly the other peer's idea of the window is not up-to-date (%llu vs %llu) or %llu last received differs, or random reply %u\n",
(unsigned long long) wnd,
(unsigned long long) vl->incoming_fc_window_size,
(unsigned long long) vl->last_outbound_window_size_received,
@@ -8814,8 +9109,7 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
* @param msg message to demultiplex
*/
static void
-demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
- const struct GNUNET_MessageHeader *msg)
+demultiplex_with_cmc (struct CommunicatorMessageContext *cmc)
{
struct GNUNET_MQ_MessageHandler handlers[] =
{ GNUNET_MQ_hd_var_size (fragment_box,
@@ -8858,6 +9152,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
cmc),
GNUNET_MQ_handler_end () };
int ret;
+ const struct GNUNET_MessageHeader *msg = cmc->mh;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Handling message of type %u with %u bytes\n",
@@ -9151,7 +9446,7 @@ reliability_box_message (struct Queue *queue,
memcpy (&msg[sizeof(rbox)], &pm[1], pm->bytes_msg);
pm->bpm = bpm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Preparing reliability box for message <%llu> of size %lu (%lu) to %s on queue %s\n",
+ "Preparing reliability box for message <%llu> of size %d (%d) to %s on queue %s\n",
pm->logging_uuid,
pm->bytes_msg,
ntohs (((const struct GNUNET_MessageHeader *) &pm[1])->size),
@@ -9197,7 +9492,6 @@ static void
update_pm_next_attempt (struct PendingMessage *pm,
struct GNUNET_TIME_Absolute next_attempt)
{
- struct VirtualLink *vl = pm->vl;
// TODO Do we really need a next_attempt value for PendingMessage other than the root Pending Message?
pm->next_attempt = next_attempt;
@@ -9218,7 +9512,8 @@ update_pm_next_attempt (struct PendingMessage *pm,
root = root->frag_parent;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Next attempt for root message <%llu> set to %s\n",
- root->logging_uuid);
+ root->logging_uuid,
+ GNUNET_STRINGS_absolute_time_to_string (next_attempt));
root->next_attempt = next_attempt;
reorder_root_pm (root, next_attempt);
}
@@ -9302,7 +9597,7 @@ struct PendingMessageScoreContext
* Select the best pending message from @a vl for transmission
* via @a queue.
*
- * @param sc[in,out] best message so far (NULL for none), plus scoring data
+ * @param[in,out] sc best message so far (NULL for none), plus scoring data
* @param queue the queue that will be used for transmission
* @param vl the virtual link providing the messages
* @param dvh path we are currently considering, or NULL for none
@@ -9353,7 +9648,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
/* determine if we have to fragment, if so add fragmentation
overhead! */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "check %u for sc->best\n",
+ "check %llu for sc->best\n",
pos->logging_uuid);
frag = GNUNET_NO;
if (((0 != queue->mtu) &&
@@ -9366,7 +9661,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
this queue */))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "fragment msg with size %u, realoverhead is %u\n",
+ "fragment msg with size %u, realoverhead is %lu\n",
pos->bytes_msg,
real_overhead);
frag = GNUNET_YES;
@@ -9396,7 +9691,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
relb = GNUNET_YES;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Create reliability box of msg with size %u, realoverhead is %u %u %u %u\n",
+ "Create reliability box of msg with size %u, realoverhead is %lu %u %u %u\n",
pos->bytes_msg,
real_overhead,
queue->mtu,
@@ -9446,7 +9741,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
if (sc_score + time_delta > pm_score)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "sc_score of %u larger, keep sc->best %u\n",
+ "sc_score of %llu larger, keep sc->best %llu\n",
pos->logging_uuid,
sc->best->logging_uuid);
continue; /* sc_score larger, keep sc->best */
@@ -9607,7 +9902,7 @@ transmit_on_queue (void *cls)
GNUNET_NO);
GNUNET_assert (NULL != sc.best->bpm);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%u %u %u %u %u\n",
+ "%lu %lu %lu %lu %u\n",
sizeof(struct GNUNET_PeerIdentity),
sizeof(struct TransportDVBoxMessage),
sizeof(struct TransportDVBoxPayloadP),
@@ -9720,12 +10015,12 @@ transmit_on_queue (void *cls)
struct GNUNET_TIME_Relative plus = GNUNET_TIME_relative_multiply (
wait_duration, 4);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Waiting %s (%llu) for ACK until %llu\n",
+ "Waiting %s (%s) for ACK until %s\n",
GNUNET_STRINGS_relative_time_to_string (
GNUNET_TIME_relative_multiply (
queue->pd.aged_rtt, 4), GNUNET_NO),
- plus,
- next);
+ GNUNET_STRINGS_relative_time_to_string (plus, GNUNET_YES),
+ GNUNET_STRINGS_absolute_time_to_string (next));
update_pm_next_attempt (pm,
GNUNET_TIME_relative_to_absolute (
GNUNET_TIME_relative_multiply (wait_duration,
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index fad2ca4a1..93790e293 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -480,7 +480,7 @@ client_connect_cb (void *cls,
/**
* Perform next action in the blacklist check.
*
- * @param cls the `struct BlacklistCheck*`
+ * @param cls the `struct GST_BlacklistCheck *`
*/
static void
do_blacklist_check (void *cls);
@@ -2120,7 +2120,7 @@ free_blacklist_entry (void *cls,
* Set traffic metric to manipulate
*
* @param cls closure
- * @param message containing information
+ * @param tm message containing information
*/
static void
handle_client_set_metric (void *cls, const struct TrafficMetricMessage *tm)
@@ -2189,11 +2189,6 @@ shutdown_task (void *cls)
}
-/**
- * Perform next action in the blacklist check.
- *
- * @param cls the `struct GST_BlacklistCheck *`
- */
static void
do_blacklist_check (void *cls)
{
@@ -2491,11 +2486,6 @@ GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer,
}
-/**
- * Cancel a blacklist check.
- *
- * @param bc check to cancel
- */
void
GST_blacklist_test_cancel (struct GST_BlacklistCheck *bc)
{
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c
index 130311e15..2438a0a48 100644
--- a/src/transport/gnunet-service-transport_ats.c
+++ b/src/transport/gnunet-service-transport_ats.c
@@ -477,13 +477,6 @@ GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
}
-/**
- * Notify ATS about the new address including the network this address is
- * located in. The address must NOT be inbound and must be new to ATS.
- *
- * @param address the address
- * @param prop performance information
- */
void
GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
const struct GNUNET_ATS_Properties *prop)
@@ -755,13 +748,6 @@ GST_ats_update_distance (const struct GNUNET_HELLO_Address *address,
}
-/**
- * Notify ATS about @a delay changes to properties of an @a address.
- * Does nothing if the @a address is not known to us.
- *
- * @param address the address
- * @param delay new delay value
- */
void
GST_ats_update_delay (const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Relative delay)
diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h
index d536714ec..ca972d1cc 100644
--- a/src/transport/gnunet-service-transport_ats.h
+++ b/src/transport/gnunet-service-transport_ats.h
@@ -110,7 +110,7 @@ GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
/**
- * Notify ATS about a new address including the network this address is
+ * Notify ATS about a new address including the network the address is
* located in. The address must NOT be inbound and must be new to ATS.
*
* @param address the address
@@ -154,7 +154,6 @@ GST_ats_update_utilization (const struct GNUNET_HELLO_Address *address,
* Does nothing if the @a address is not known to us.
*
* @param address the address
- * @param session the session
* @param delay new delay value
*/
void
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c
index 472c77c27..1e5e8a225 100644
--- a/src/transport/gnunet-service-transport_hello.c
+++ b/src/transport/gnunet-service-transport_hello.c
@@ -334,16 +334,6 @@ GST_hello_modify_addresses (int addremove,
}
-/**
- * Test if a particular address is one of ours.
- *
- * @param address address to test
- * @param sig location where to cache PONG signatures for this address [set]
- * @param sig_expiration how long until the current 'sig' expires?
- * (ZERO if sig was never created) [set]
- * @return #GNUNET_YES if this is one of our addresses,
- * #GNUNET_NO if not
- */
int
GST_hello_test_address (const struct GNUNET_HELLO_Address *address,
struct GNUNET_CRYPTO_EddsaSignature **sig,
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 04d1774c0..9f39b2dca 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -168,7 +168,7 @@ static struct GNUNET_SCHEDULER_Task *generic_send_delay_task;
/**
* Set traffic metric to manipulate
*
- * @param message containing information
+ * @param tm message containing information
*/
void
GST_manipulation_set_metric (const struct TrafficMetricMessage *tm)
@@ -349,7 +349,7 @@ GST_manipulation_send (const struct GNUNET_PeerIdentity *target,
*
* @param address binary address
* @param session the session
- * @param prop[IN|OUT] metrics to modify
+ * @param[in,out] prop metrics to modify
*/
void
GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index ca1b4d1da..e61441d9f 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1768,16 +1768,6 @@ GST_neighbours_calculate_receive_delay (const struct
}
-/**
- * Transmit a message to the given target using the active connection.
- *
- * @param target destination
- * @param msg message to send
- * @param msg_size number of bytes in msg
- * @param timeout when to fail with timeout
- * @param cont function to call when done
- * @param cont_cls closure for @a cont
- */
void
GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
const void *msg,
@@ -3019,13 +3009,6 @@ GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
}
-/**
- * Master task run for every neighbour. Performs all of the time-related
- * activities (keep alive, send next message, disconnect if idle, finish
- * clean up after disconnect).
- *
- * @param cls the 'struct NeighbourMapEntry' for which we are running
- */
static void
master_task (void *cls)
{
@@ -3646,13 +3629,6 @@ delayed_disconnect (void *cls)
}
-/**
- * We received a quota message from the given peer,
- * validate and process.
- *
- * @param peer sender of the message
- * @param msg the quota message
- */
void
GST_neighbours_handle_quota_message (const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *msg)
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index 13aeab4e6..7ce911aa1 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -292,7 +292,7 @@ GST_neighbour_get_current_address (const struct GNUNET_PeerIdentity *peer);
/**
- * We received a quoat message from the given peer,
+ * We received a quota message from the given peer,
* validate and process.
*
* @param peer sender of the message
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c
index c88532806..218ef80ab 100644
--- a/src/transport/gnunet-service-transport_plugins.c
+++ b/src/transport/gnunet-service-transport_plugins.c
@@ -83,7 +83,6 @@ static struct TransportPlugin *plugins_tail;
*
* @param cls closure
* @param address address to update metrics for
- * @param session the session
* @param distance new distance
*/
static void
@@ -121,18 +120,6 @@ plugin_env_address_to_type (void *cls,
}
-/**
- * Load and initialize all plugins. The respective functions will be
- * invoked by the plugins when the respective events happen. The
- * closure will be set to a 'const char*' containing the name of the
- * plugin that caused the call.
- *
- * @param recv_cb function to call when data is received
- * @param address_cb function to call when our public addresses changed
- * @param session_start_cb function to call when a session was created
- * @param session_end_cb function to call when a session was terminated
- * @param address_type_cb function to call when a address type is requested
- */
void
GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
GNUNET_TRANSPORT_AddressNotification address_cb,
@@ -431,12 +418,6 @@ GST_plugins_a2s (const struct GNUNET_HELLO_Address *address)
}
-/**
- * Register callback with all plugins to monitor their status.
- *
- * @param cb callback to register, NULL to unsubscribe
- * @param cb_cls closure for @a cb
- */
void
GST_plugins_monitor_subscribe (GNUNET_TRANSPORT_SessionInfoCallback cb,
void *cb_cls)
diff --git a/src/transport/gnunet-service-transport_plugins.h b/src/transport/gnunet-service-transport_plugins.h
index 0e69da074..fdd819fc5 100644
--- a/src/transport/gnunet-service-transport_plugins.h
+++ b/src/transport/gnunet-service-transport_plugins.h
@@ -40,13 +40,9 @@
* plugin that caused the call.
*
* @param recv_cb function to call when data is received
- * @param register_quota_cb function to call to register a quota callback
- * @param unregister_quota_cb function to call to unregister a quota callback
* @param address_cb function to call when our public addresses changed
* @param session_start_cb function to call when a session was created
* @param session_end_cb function to call when a session was terminated
- * @param address_type_cb function to call when a address type is requested
- * @param metric_update_cb function to call when address metrics change
*/
void
GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb,
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 18bfcc054..82468992b 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -556,7 +556,6 @@ client_reschedule_session_timeout (struct GNUNET_ATS_Session *s)
* Task performing curl operations
*
* @param cls plugin as closure
- * @param tc gnunet scheduler task context
*/
static void
client_run (void *cls);
@@ -1289,11 +1288,6 @@ client_receive (void *stream,
}
-/**
- * Task performing curl operations
- *
- * @param cls plugin as closure
- */
static void
client_run (void *cls)
{
@@ -1692,12 +1686,6 @@ client_connect_get (struct GNUNET_ATS_Session *s)
}
-/**
- * Connect a HTTP put request
- *
- * @param s the session to connect
- * @return #GNUNET_SYSERR for hard failure, #GNUNET_OK for ok
- */
static int
client_connect_put (struct GNUNET_ATS_Session *s)
{
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index 75bf8b74a..40353daeb 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -407,20 +407,6 @@ http_common_dns_ip_lookup (const char *name,
}
-/**
- * Convert the transports address to a nice, human-readable
- * format.
- *
- * @param cls closure
- * @param type name of the transport that generated the address
- * @param addr one of the addresses of the host, NULL for the last address
- * the specific address format depends on the transport
- * @param addrlen length of the @a addr
- * @param numeric should (IP) addresses be displayed in numeric form?
- * @param timeout after how long should we give up?
- * @param asc function to call on each string
- * @param asc_cls closure for @a asc
- */
void
http_common_plugin_address_pretty_printer (void *cls, const char *type,
const void *addr,
@@ -597,17 +583,6 @@ http_common_plugin_address_to_url (void *cls,
}
-/**
- * Function called for a quick conversion of the binary address to
- * a numeric address. Note that the caller must not free the
- * address and that the next call to this function is allowed
- * to override the address again.
- *
- * @param plugin the name of the plugin
- * @param addr binary address
- * @param addrlen length of the address
- * @return string representing the same address
- */
const char *
http_common_plugin_address_to_string (const char *plugin,
const void *addr,
@@ -642,18 +617,6 @@ http_common_plugin_address_to_string (const char *plugin,
}
-/**
- * Function called to convert a string address to
- * a binary address.
- *
- * @param cls closure ('struct Plugin*')
- * @param addr string address
- * @param addrlen length of the @a addr
- * @param buf location to store the buffer
- * If the function returns #GNUNET_SYSERR, its contents are undefined.
- * @param added length of created address
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
- */
int
http_common_plugin_string_to_address (void *cls,
const char *addr,
@@ -721,14 +684,6 @@ http_common_plugin_string_to_address (void *cls,
}
-/**
- * Create a HTTP address from a socketaddr
- *
- * @param protocol protocol
- * @param addr sockaddr * address
- * @param addrlen length of the address
- * @return the HttpAddress
- */
struct HttpAddress *
http_common_address_from_socket (const char *protocol,
const struct sockaddr *addr,
diff --git a/src/transport/plugin_transport_http_common.h b/src/transport/plugin_transport_http_common.h
index 299dc0e68..7a532249d 100644
--- a/src/transport/plugin_transport_http_common.h
+++ b/src/transport/plugin_transport_http_common.h
@@ -137,7 +137,7 @@ http_split_address (const char *addr);
* @param type name of the transport that generated the address
* @param addr one of the addresses of the host, NULL for the last address
* the specific address format depends on the transport
- * @param addrlen length of the address
+ * @param addrlen length of @a addr
* @param numeric should (IP) addresses be displayed in numeric form?
* @param timeout after how long should we give up?
* @param asc function to call on each string
@@ -178,7 +178,7 @@ http_common_plugin_address_to_string (const char *plugin,
*
* @param cls closure (`struct Plugin*`)
* @param addr string address
- * @param addrlen length of the address
+ * @param addrlen length of @a addr
* @param buf location to store the buffer
* If the function returns #GNUNET_SYSERR, its contents are undefined.
* @param added length of created address
@@ -198,7 +198,7 @@ http_common_plugin_string_to_address (void *cls,
* @param protocol protocol
* @param addr `sockaddr *` address
* @param addrlen length of the @a addr
- * @return the string
+ * @return A pointer to a `struct HttpAddress` derived from @a addr
*/
struct HttpAddress *
http_common_address_from_socket (const char *protocol,
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 78b030e9a..3ad2356b0 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -2563,7 +2563,7 @@ server_remove_address (void *cls,
* Our external IP address/port mapping has changed.
*
* @param cls closure, the 'struct LocalAddrList'
- * @param app_ctx[in,out] location where the app can store stuff
+ * @param[in,out] app_ctx location where the app can store stuff
* on add and retrieve it on remove
* @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean
* the previous (now invalid) one
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index ac4cc672f..ceae64709 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1418,7 +1418,7 @@ notify_session_monitor (struct Plugin *plugin,
* Our external IP address/port mapping has changed.
*
* @param cls closure, the `struct Plugin`
- * @param app_ctx[in,out] location where the app can store stuff
+ * @param[in,out] app_ctx location where the app can store stuff
* on add and retrieve it on remove
* @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean
* the previous (now invalid) one
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 2db31caa3..0d3ca449d 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1254,7 +1254,7 @@ udp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
* Our external IP address/port mapping has changed.
*
* @param cls closure, the `struct Plugin`
- * @param app_ctx[in,out] location where the app can store stuff
+ * @param[in,out] app_ctx location where the app can store stuff
* on add and retrieve it on remove
* @param add_remove #GNUNET_YES to mean the new public IP address,
* #GNUNET_NO to mean the previous (now invalid) one
diff --git a/src/transport/tcp_server_legacy.c b/src/transport/tcp_server_legacy.c
index f4d48d4f6..bb572c843 100644
--- a/src/transport/tcp_server_legacy.c
+++ b/src/transport/tcp_server_legacy.c
@@ -699,11 +699,6 @@ GNUNET_SERVER_suspend (struct GNUNET_SERVER_Handle *server)
}
-/**
- * Resume accepting connections from the listen socket.
- *
- * @param server server to stop accepting connections.
- */
void
GNUNET_SERVER_resume (struct GNUNET_SERVER_Handle *server)
{
@@ -1620,21 +1615,6 @@ transmit_ready_callback_wrapper (void *cls, size_t size, void *buf)
}
-/**
- * Notify us when the server has enough space to transmit
- * a message of the given size to the given client.
- *
- * @param client client to transmit message to
- * @param size requested amount of buffer space
- * @param timeout after how long should we give up (and call
- * notify with buf NULL and size 0)?
- * @param callback function to call when space is available
- * @param callback_cls closure for @a callback
- * @return non-NULL if the notify callback was queued; can be used
- * to cancel the request using
- * #GNUNET_SERVER_notify_transmit_ready_cancel().
- * NULL if we are already going to notify someone else (busy)
- */
struct GNUNET_SERVER_TransmitHandle *
GNUNET_SERVER_notify_transmit_ready (struct GNUNET_SERVER_Client *client,
size_t size,
diff --git a/src/transport/test_transport_api2_tcp_node1.conf b/src/transport/test_transport_api2_tcp_node1.conf
index b8a743a3b..d396f43d7 100644
--- a/src/transport/test_transport_api2_tcp_node1.conf
+++ b/src/transport/test_transport_api2_tcp_node1.conf
@@ -5,7 +5,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
[transport]
BINARY = gnunet-service-tng
PLUGINS = tcp
-#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_peer1-%p
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=$GNUNET_TEST_HOME/vg_peer1-%p
UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock
[communicator-tcp]
@@ -14,11 +14,11 @@ BINDTO = 192.168.15.1:60002
DISABLE_V6 = YES
IMMEDIATE_START = YES
UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock
-#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_ctpeer1-%p
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=$GNUNET_TEST_HOME/vg_ctpeer1-%p
#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
[communicator-udp]
-#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=/tmp/vg_cupeer1-%p
+#PREFIX = valgrind --leak-check=full --track-origins=yes --trace-children=yes --log-file=$GNUNET_TEST_HOME/vg_cupeer1-%p
BINARY = gnunet-communicator-udp
BINDTO = 192.168.15.1:60002
DISABLE_V6 = YES
diff --git a/src/transport/test_transport_api2_tcp_node2.conf b/src/transport/test_transport_api2_tcp_node2.conf
index f94368b3f..a4557e7ea 100644
--- a/src/transport/test_transport_api2_tcp_node2.conf
+++ b/src/transport/test_transport_api2_tcp_node2.conf
@@ -4,7 +4,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
[transport]
BINARY = gnunet-service-tng
-#PREFIX = valgrind --log-file=/tmp/vg_peer2-%p
+#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_peer2-%p
UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p2.sock
[communicator-tcp]
@@ -12,7 +12,7 @@ BINARY = gnunet-communicator-tcp
BINDTO = 192.168.15.2:60003
DISABLE_V6 = YES
IMMEDIATE_START = YES
-#PREFIX = valgrind --log-file=/tmp/vg_comm2-%p
+#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_comm2-%p
UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p2.sock
[peerstore]
diff --git a/src/transport/test_transport_api2_tcp_peer1.conf b/src/transport/test_transport_api2_tcp_peer1.conf
index 745ed6887..5a21b2adb 100644
--- a/src/transport/test_transport_api2_tcp_peer1.conf
+++ b/src/transport/test_transport_api2_tcp_peer1.conf
@@ -5,7 +5,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
[transport]
BINARY = gnunet-service-tng
PLUGINS = tcp
-#PREFIX = valgrind --log-file=/tmp/vg_peer1-%p
+#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_peer1-%p
UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock
[communicator-tcp]
@@ -14,7 +14,7 @@ BINDTO = 60002
DISABLE_V6 = YES
IMMEDIATE_START = YES
UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock
-#PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p
+#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_cpeer1-%p
[peerstore]
IMMEDIATE_START = YES
diff --git a/src/transport/test_transport_api2_tcp_peer2.conf b/src/transport/test_transport_api2_tcp_peer2.conf
index 022468bcd..e42704100 100644
--- a/src/transport/test_transport_api2_tcp_peer2.conf
+++ b/src/transport/test_transport_api2_tcp_peer2.conf
@@ -4,7 +4,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
[transport]
BINARY = gnunet-service-tng
-#PREFIX = valgrind --log-file=/tmp/vg_peer2-%p
+#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_peer2-%p
UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p2.sock
[communicator-tcp]
@@ -12,7 +12,7 @@ BINARY = gnunet-communicator-tcp
BINDTO = 60003
DISABLE_V6 = YES
IMMEDIATE_START = YES
-#PREFIX = valgrind --log-file=/tmp/vg_comm2-%p
+#PREFIX = valgrind --log-file=$GNUNET_TEST_HOME/vg_comm2-%p
UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p2.sock
[peerstore]
diff --git a/src/transport/test_transport_distance_vector_circle_topo.conf b/src/transport/test_transport_distance_vector_circle_topo.conf
index 210179291..e8d694c3a 100644
--- a/src/transport/test_transport_distance_vector_circle_topo.conf
+++ b/src/transport/test_transport_distance_vector_circle_topo.conf
@@ -1,7 +1,6 @@
M:1
N:3
X:0
-AC:1
B:0
T:libgnunet_test_transport_plugin_cmd_simple_send_dv
R:1|{tcp_port:0}|{udp_port:1}
diff --git a/src/transport/test_transport_distance_vector_inverse_topo.conf b/src/transport/test_transport_distance_vector_inverse_topo.conf
new file mode 100644
index 000000000..e062b3e2e
--- /dev/null
+++ b/src/transport/test_transport_distance_vector_inverse_topo.conf
@@ -0,0 +1,13 @@
+M:1
+N:4
+X:0
+AC:1
+T:libgnunet_test_transport_plugin_cmd_simple_send_dv
+R:1|{tcp_port:1}|{udp_port:0}
+R:2|{tcp_port:1}|{udp_port:0}
+R:3|{tcp_port:1}|{udp_port:0}
+R:4|{tcp_port:1}|{udp_port:0}
+P:1:1|{connect:{P:2:1:tcp}}|{AC:2}
+P:2:1|{connect:{P:3:1:tcp}}|{AC:2}
+P:3:1|{connect:{P:4:1:tcp}}|{AC:2}
+P:4:1|{AC:3} \ No newline at end of file
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c
index 154c0abca..5941a991b 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -40,32 +40,6 @@
#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-struct TestState
-{
- /**
- * Callback to write messages to the master loop.
- *
- */
- TESTING_CMD_HELPER_write_cb write_message;
-
- /**
- * The name for a specific test environment directory.
- *
- */
- char *testdir;
-
- /**
- * The name for the configuration file of the specific node.
- *
- */
- char *cfgname;
-
- /**
- * The complete topology information.
- */
- struct GNUNET_TESTING_NetjailTopology *topology;
-};
-
static struct GNUNET_TESTING_Command block_send;
static struct GNUNET_TESTING_Command block_receive;
@@ -139,19 +113,12 @@ handle_result (void *cls,
enum GNUNET_GenericReturnValue rv)
{
struct TestState *ts = cls;
- struct GNUNET_MessageHeader *reply;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Local test exits with status %d\n",
rv);
- reply = GNUNET_TESTING_send_local_test_finished_msg (rv);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message prepared\n");
- ts->write_message (reply,
- ntohs (reply->size));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message send\n");
+ ts->finished_cb ();
GNUNET_free (ts->testdir);
GNUNET_free (ts->cfgname);
GNUNET_TESTING_free_topology (ts->topology);
@@ -218,7 +185,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
char *n,
char *local_m,
char *topology_data,
- unsigned int *read_file)
+ unsigned int *read_file,
+ TESTING_CMD_HELPER_finish_cb finished_cb)
{
unsigned int n_int;
@@ -227,6 +195,13 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
unsigned int num;
struct TestState *ts = GNUNET_new (struct TestState);
struct GNUNET_TESTING_NetjailTopology *topology;
+ unsigned int sscanf_ret = 0;
+
+ ts->finished_cb = finished_cb;
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "n %s m %s\n",
+ n,
+ m);
if (GNUNET_YES == *read_file)
{
@@ -239,9 +214,27 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
ts->topology = topology;
- sscanf (m, "%u", &m_int);
- sscanf (n, "%u", &n_int);
- sscanf (local_m, "%u", &local_m_int);
+ errno = 0;
+ sscanf_ret = sscanf (m, "%u", &m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (n, "%u", &n_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (local_m, "%u", &local_m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
if (0 == n_int)
num = m_int;
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
index 9d6844be1..3a282bb11 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c
@@ -40,32 +40,6 @@
#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-struct TestState
-{
- /**
- * Callback to write messages to the master loop.
- *
- */
- TESTING_CMD_HELPER_write_cb write_message;
-
- /**
- * The name for a specific test environment directory.
- *
- */
- char *testdir;
-
- /**
- * The name for the configuration file of the specific node.
- *
- */
- char *cfgname;
-
- /**
- * The complete topology information.
- */
- struct GNUNET_TESTING_NetjailTopology *topology;
-};
-
static struct GNUNET_TESTING_Command block_send;
static struct GNUNET_TESTING_Command block_receive;
@@ -140,19 +114,11 @@ handle_result (void *cls,
enum GNUNET_GenericReturnValue rv)
{
struct TestState *ts = cls;
- struct GNUNET_MessageHeader *reply;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Local test exits with status %d\n",
rv);
- reply = GNUNET_TESTING_send_local_test_finished_msg (rv);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message prepared\n");
- ts->write_message (reply,
- ntohs (reply->size));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message send\n");
+ ts->finished_cb ();
GNUNET_free (ts->testdir);
GNUNET_free (ts->cfgname);
GNUNET_TESTING_free_topology (ts->topology);
@@ -251,7 +217,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
char *n,
char *local_m,
char *topology_data,
- unsigned int *read_file)
+ unsigned int *read_file,
+ TESTING_CMD_HELPER_finish_cb finished_cb)
{
unsigned int n_int;
unsigned int m_int;
@@ -259,8 +226,13 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
unsigned int num;
struct TestState *ts = GNUNET_new (struct TestState);
struct GNUNET_TESTING_NetjailTopology *topology;
+ unsigned int sscanf_ret = 0;
-
+ ts->finished_cb = finished_cb;
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "n %s m %s\n",
+ n,
+ m);
if (GNUNET_YES == *read_file)
{
@@ -273,9 +245,27 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
ts->topology = topology;
- sscanf (m, "%u", &m_int);
- sscanf (n, "%u", &n_int);
- sscanf (local_m, "%u", &local_m_int);
+ errno = 0;
+ sscanf_ret = sscanf (m, "%u", &m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (n, "%u", &n_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (local_m, "%u", &local_m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
if (0 == n_int)
num = m_int;
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_dv.c b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
index f1f168102..8bfa1fd0a 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
@@ -40,33 +40,6 @@
#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-struct TestState
-{
- /**
- * Callback to write messages to the master loop.
- *
- */
- TESTING_CMD_HELPER_write_cb write_message;
-
- /**
- * The name for a specific test environment directory.
- *
- */
- char *testdir;
-
- /**
- * The name for the configuration file of the specific node.
- *
- */
- char *cfgname;
-
- /**
- * The complete topology information.
- */
- struct GNUNET_TESTING_NetjailTopology *topology;
-
-};
-
/**
* The number of messages received.
*/
@@ -107,8 +80,6 @@ handle_test (void *cls,
{
struct GNUNET_PeerIdentity *peer = cls;
const struct GNUNET_TESTING_AsyncContext *ac_block;
- const struct GNUNET_TESTING_AsyncContext *ac_start;
- const struct GNUNET_TESTING_Command *cmd;
const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
unsigned int connected;
struct BlockState *bs;
@@ -195,19 +166,11 @@ handle_result (void *cls,
enum GNUNET_GenericReturnValue rv)
{
struct TestState *ts = cls;
- struct GNUNET_MessageHeader *reply;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Local test exits with status %d\n",
rv);
- reply = GNUNET_TESTING_send_local_test_finished_msg (rv);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message prepared\n");
- ts->write_message (reply,
- ntohs (reply->size));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message send\n");
+ ts->finished_cb ();
GNUNET_free (ts->testdir);
GNUNET_free (ts->cfgname);
GNUNET_TESTING_free_topology (ts->topology);
@@ -277,7 +240,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
char *n,
char *local_m,
char *topology_data,
- unsigned int *read_file)
+ unsigned int *read_file,
+ TESTING_CMD_HELPER_finish_cb finished_cb)
{
unsigned int n_int;
unsigned int m_int;
@@ -292,6 +256,13 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
ts),
GNUNET_MQ_handler_end ()
};
+ unsigned int sscanf_ret = 0;
+
+ ts->finished_cb = finished_cb;
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "n %s m %s\n",
+ n,
+ m);
if (GNUNET_YES == *read_file)
{
@@ -304,9 +275,27 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
ts->topology = topology;
- sscanf (m, "%u", &m_int);
- sscanf (n, "%u", &n_int);
- sscanf (local_m, "%u", &local_m_int);
+ errno = 0;
+ sscanf_ret = sscanf (m, "%u", &m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (n, "%u", &n_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (local_m, "%u", &local_m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
if (0 == n_int)
num = m_int;
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 537832e61..5a0dac32b 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -34,38 +34,12 @@
/**
* Generic logging shortcut
*/
-#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "udp-backchannel", __VA_ARGS__)
#define BASE_DIR "testdir"
#define TOPOLOGY_CONFIG "test_transport_udp_backchannel_topo.conf"
-struct TestState
-{
- /**
- * Callback to write messages to the master loop.
- *
- */
- TESTING_CMD_HELPER_write_cb write_message;
-
- /**
- * The name for a specific test environment directory.
- *
- */
- char *testdir;
-
- /**
- * The name for the configuration file of the specific node.
- *
- */
- char *cfgname;
-
- /**
- * The complete topology information.
- */
- struct GNUNET_TESTING_NetjailTopology *topology;
-};
-
static struct GNUNET_TESTING_Command block_send;
static struct GNUNET_TESTING_Command connect_peers;
@@ -136,18 +110,12 @@ handle_result (void *cls,
enum GNUNET_GenericReturnValue rv)
{
struct TestState *ts = cls;
- struct GNUNET_MessageHeader *reply;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Local test exits with status %d\n",
rv);
- reply = GNUNET_TESTING_send_local_test_finished_msg (rv);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "message prepared\n");
- ts->write_message (reply,
- ntohs (reply->size));
+ ts->finished_cb ();
GNUNET_free (ts->testdir);
GNUNET_free (ts->cfgname);
GNUNET_TESTING_free_topology (ts->topology);
@@ -209,7 +177,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
char *n,
char *local_m,
char *topology_data,
- unsigned int *read_file)
+ unsigned int *read_file,
+ TESTING_CMD_HELPER_finish_cb finished_cb)
{
unsigned int n_int;
@@ -217,19 +186,47 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
unsigned int local_m_int;
unsigned int num;
struct TestState *ts = GNUNET_new (struct TestState);
-
struct GNUNET_TESTING_NetjailTopology *topology;
+ unsigned int sscanf_ret = 0;
+
+ ts->finished_cb = finished_cb;
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "n %s m %s\n",
+ n,
+ m);
if (GNUNET_YES == *read_file)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "read from file\n");
topology = GNUNET_TESTING_get_topo_from_file (topology_data);
+ }
else
topology = GNUNET_TESTING_get_topo_from_string (topology_data);
ts->topology = topology;
- sscanf (m, "%u", &m_int);
- sscanf (n, "%u", &n_int);
- sscanf (local_m, "%u", &local_m_int);
+ errno = 0;
+ sscanf_ret = sscanf (m, "%u", &m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (n, "%u", &n_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
+ sscanf_ret = sscanf (local_m, "%u", &local_m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
if (0 == n_int)
@@ -327,7 +324,7 @@ libgnunet_test_transport_plugin_cmd_udp_backchannel_init (void *cls)
GNUNET_log_setup ("udp-backchannel",
"DEBUG",
- NULL);
+ "plugin.out");
api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions);
api->start_testcase = &start_testcase;
diff --git a/src/transport/test_transport_simple_send_dv_circle.sh b/src/transport/test_transport_simple_send_dv_circle.sh
index bd5f00abe..353d14f65 100755
--- a/src/transport/test_transport_simple_send_dv_circle.sh
+++ b/src/transport/test_transport_simple_send_dv_circle.sh
@@ -9,3 +9,4 @@ if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; then
fi
fi
exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_distance_vector_circle_topo.conf"
+# sudo valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip/sed/bash ./test_transport_start_with_config test_transport_distance_vector_circle_topo.conf
diff --git a/src/transport/test_transport_simple_send_dv_inverse.sh b/src/transport/test_transport_simple_send_dv_inverse.sh
new file mode 100755
index 000000000..eac437cba
--- /dev/null
+++ b/src/transport/test_transport_simple_send_dv_inverse.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+if ! [ -d "/run/netns" ]; then
+ echo You have to create the directory /run/netns.
+fi
+if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" == 1 ]; then
+ # exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip/sed/bash ./test_transport_start_with_config test_transport_distance_vector_inverse_topo.conf"
+ exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_distance_vector_inverse_topo.conf"
+else
+ echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"
+ exit 78
+fi
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h
index 5a3fb22d6..c577feb34 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -227,9 +227,9 @@ GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
*
* @param label name for command
* @param start_peer_label Label of the cmd to start a peer.
- * @param create_peer_label Label of the cmd which started the test system.
+ * @param create_label Label of the cmd which started the test system.
* @param num Number globally identifying the node.
- * @param The topology for the test setup.
+ * @param topology The topology for the test setup.
* @param additional_connects Number of additional connects this cmd will wait for not triggered by this cmd.
* @return command.
*/
@@ -248,9 +248,9 @@ GNUNET_TRANSPORT_cmd_connect_peers (
*
* @param label name for command.
* @param start_peer_label Label of the cmd to start a peer.
- * @param create_peer_label Label of the cmd which started the test system.
+ * @param create_label Label of the cmd which started the test system.
* @param num Number globally identifying the node.
- * @param The topology for the test setup.
+ * @param topology The topology for the test setup.
* @return command.
*/
struct GNUNET_TESTING_Command
@@ -271,7 +271,7 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label,
* @param num Number globally identifying the node.
* @param node_n The number of the node in a network namespace.
* @param namespace_n The number of the network namespace.
- * @param The topology for the test setup.
+ * @param topology The topology for the test setup.
* @return command.
*/
struct GNUNET_TESTING_Command
diff --git a/src/transport/transport-testing-communicator.c b/src/transport/transport-testing-communicator.c
index ce4af01f2..1bf88bb3d 100644
--- a/src/transport/transport-testing-communicator.c
+++ b/src/transport/transport-testing-communicator.c
@@ -232,7 +232,7 @@ check_communicator_backchannel (void *cls,
* Pass the message to the client.
*
* @param cls Closure - communicator handle
- * @param msg Message
+ * @param bc_msg Message
*/
static void
handle_communicator_backchannel (void *cls,
@@ -283,7 +283,7 @@ handle_communicator_backchannel (void *cls,
* Address of our peer added. Test message is well-formed.
*
* @param cls the client
- * @param aam the send message that was sent
+ * @param msg the send message that was sent
* @return #GNUNET_OK if message is well-formed
*/
static int
@@ -365,7 +365,7 @@ check_incoming_msg (void *cls,
* Pass the message to the client.
*
* @param cls Closure - communicator handle
- * @param msg Message
+ * @param inc_msg Message
*/
static void
handle_incoming_msg (void *cls,
@@ -1146,15 +1146,6 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (
}
-/**
- * @brief Instruct communicator to send data
- *
- * @param tc_queue The queue to use for sending
- * @param cont function to call when done sending
- * @param cont_cls closure for @a cont
- * @param payload Data to send
- * @param payload_size Size of the @a payload
- */
void
GNUNET_TRANSPORT_TESTING_transport_communicator_send
(struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h,
diff --git a/src/transport/transport-testing-filenames.c b/src/transport/transport-testing-filenames.c
index 7c136b690..70c1ee55a 100644
--- a/src/transport/transport-testing-filenames.c
+++ b/src/transport/transport-testing-filenames.c
@@ -61,13 +61,6 @@ extract_filename (const char *file)
}
-/**
- * Extracts the test filename from an absolute file name and removes
- * the extension
- *
- * @param file absolute file name
- * @return the result
- */
char *
GNUNET_TRANSPORT_TESTING_get_test_name (const char *file)
{
@@ -96,12 +89,6 @@ GNUNET_TRANSPORT_TESTING_get_test_name (const char *file)
}
-/**
- * Extracts the filename from an absolute file name and removes the extension
- *
- * @param file absolute file name
- * @return the result
- */
char *
GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file)
{
@@ -115,13 +102,6 @@ GNUNET_TRANSPORT_TESTING_get_test_source_name (const char *file)
}
-/**
- * Extracts the plugin name from an absolute file name and the test name
- *
- * @param file absolute file name
- * @param test test name
- * @return the result
- */
char *
GNUNET_TRANSPORT_TESTING_get_test_plugin_name (const char *file,
const char *test)
@@ -161,14 +141,6 @@ suc:
}
-/**
- * This function takes the filename (e.g. argv[0), removes a "lt-"-prefix and
- * if existing ".exe"-prefix and adds the peer-number
- *
- * @param file filename of the test, e.g. argv[0]
- * @param count peer number
- * @return the result
- */
char *
GNUNET_TRANSPORT_TESTING_get_config_name (const char *file,
int count)
diff --git a/src/transport/transport-testing-main.c b/src/transport/transport-testing-main.c
index 20c58eeee..8d1727d77 100644
--- a/src/transport/transport-testing-main.c
+++ b/src/transport/transport-testing-main.c
@@ -253,7 +253,7 @@ my_nc (void *cls,
*
* @param cls our `struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *`
* @param peer peer we got disconnected from
- * @param custom_cls return value from @my_nc
+ * @param custom_cls return value from @a my_nc
*/
static void
my_nd (void *cls,
diff --git a/src/transport/transport-testing-main2.c b/src/transport/transport-testing-main2.c
index 62aa3ceb7..de0b7f4cd 100644
--- a/src/transport/transport-testing-main2.c
+++ b/src/transport/transport-testing-main2.c
@@ -253,7 +253,7 @@ my_nc (void *cls,
*
* @param cls our `struct GNUNET_TRANSPORT_TESTING_InternalPeerContext *`
* @param peer peer we got disconnected from
- * @param custom_cls return value from @my_nc
+ * @param custom_cls return value from @a my_nc
*/
static void
my_nd (void *cls,
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 6d41ec098..f0dee7388 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -379,19 +379,6 @@ retrieve_hello (void *cls)
}
-/**
- * Start a peer with the given configuration
- * @param tth the testing handle
- * @param cfgname configuration file
- * @param peer_id a unique number to identify the peer
- * @param handlers functions for receiving messages
- * @param nc connect callback
- * @param nd disconnect callback
- * @param cb_cls closure for callback
- * @param start_cb start callback
- * @param start_cb_cls closure for callback
- * @return the peer context
- */
struct GNUNET_TRANSPORT_TESTING_PeerContext *
GNUNET_TRANSPORT_TESTING_start_peer (struct
GNUNET_TRANSPORT_TESTING_Handle *tth,
@@ -545,14 +532,6 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct
}
-/**
- * Stops and restarts the given peer, sleeping (!) for 5s in between.
- *
- * @param p the peer
- * @param restart_cb callback to call when restarted
- * @param restart_cb_cls callback closure
- * @return #GNUNET_OK in success otherwise #GNUNET_SYSERR
- */
int
GNUNET_TRANSPORT_TESTING_restart_peer (struct
GNUNET_TRANSPORT_TESTING_PeerContext *p,
@@ -751,11 +730,6 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct
}*/
-/**
- * Offer the current HELLO of P2 to P1.
- *
- * @param cls our `struct GNUNET_TRANSPORT_TESTING_ConnectRequest`
- */
static void
offer_hello (void *cls)
{
@@ -859,13 +833,6 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct
}
-/**
- * Cancel the request to connect two peers
- * Tou MUST cancel the request if you stop the peers before the peers connected successfully
- *
- * @param tth transport testing handle
- * @param cc a connect request handle
- */
void
GNUNET_TRANSPORT_TESTING_connect_peers_cancel (struct
GNUNET_TRANSPORT_TESTING_ConnectRequest
diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h
index e2167ca7e..b5db28500 100644
--- a/src/transport/transport-testing2.h
+++ b/src/transport/transport-testing2.h
@@ -288,7 +288,7 @@ GNUNET_TRANSPORT_TESTING_done (struct GNUNET_TRANSPORT_TESTING_Handle *tth);
*
* @param tth the testing handle
* @param cfgname configuration file
- * @param peer_id the peer_id
+ * @param peer_id an identification number for the peer
* @param handlers functions for receiving messages
* @param nc connect callback
* @param nd disconnect callback
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 8ffc87070..c06c2abb3 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -773,6 +773,11 @@ struct GNUNET_TRANSPORT_IncomingMessage
*/
struct GNUNET_PeerIdentity sender;
+ /**
+ * Direct neighbour sender identifier.
+ */
+ struct GNUNET_PeerIdentity neighbour_sender;
+
/* followed by the message */
};
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c
index 2a80db87b..b79f0d8bf 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -540,12 +540,21 @@ handle_incoming_ack (
&incoming_ack->sender,
sizeof(struct GNUNET_PeerIdentity))))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Done with message with flow control id %lu for sender %s from sender %s\n",
+ incoming_ack->fc_id,
+ GNUNET_i2s (&fc->sender),
+ GNUNET_i2s (&incoming_ack->sender));
GNUNET_CONTAINER_DLL_remove (ch->fc_head, ch->fc_tail, fc);
fc->cb (fc->cb_cls, GNUNET_OK);
GNUNET_free (fc);
return;
}
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Message with flow control id %lu from sender %s not found\n",
+ incoming_ack->fc_id,
+ GNUNET_i2s (&incoming_ack->sender));
GNUNET_break (0);
disconnect (ch);
/* TODO: maybe do this with exponential backoff/delay */
@@ -793,24 +802,6 @@ reconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch)
}
-/**
- * Connect to the transport service.
- *
- * @param cfg configuration to use
- * @param config_section section of the configuration to use for options
- * @param addr_prefix address prefix for addresses supported by this
- * communicator, could be NULL for incoming-only communicators
- * @param cc what characteristics does the communicator have?
- * @param mtu maximum message size supported by communicator, 0 if
- * sending is not supported, SIZE_MAX for no MTU
- * @param mq_init function to call to initialize a message queue given
- * the address of another peer, can be NULL if the
- * communicator only supports receiving messages
- * @param mq_init_cls closure for @a mq_init
- * @param notify_cb function to pass backchannel messages to communicator
- * @param notify_cb_cls closure for @a notify_cb
- * @return NULL on error
- */
struct GNUNET_TRANSPORT_CommunicatorHandle *
GNUNET_TRANSPORT_communicator_connect (
const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -871,26 +862,6 @@ GNUNET_TRANSPORT_communicator_disconnect (
/* ************************* Receiving *************************** */
-/**
- * Notify transport service that the communicator has received
- * a message.
- *
- * @param ch connection to transport service
- * @param sender presumed sender of the message (details to be checked
- * by higher layers)
- * @param msg the message
- * @param expected_addr_validity how long does the communicator believe it
- * will continue to be able to receive messages from the same address
- * on which it received this message?
- * @param cb function to call once handling the message is done, NULL if
- * flow control is not supported by this communicator
- * @param cb_cls closure for @a cb
- * @return #GNUNET_OK if all is well, #GNUNET_NO if the message was
- * immediately dropped due to memory limitations (communicator
- * should try to apply back pressure),
- * #GNUNET_SYSERR if the message could not be delivered because
- * the transport service is not yet up
- */
int
GNUNET_TRANSPORT_communicator_receive (
struct GNUNET_TRANSPORT_CommunicatorHandle *ch,
@@ -948,6 +919,10 @@ GNUNET_TRANSPORT_communicator_receive (
fc->cb = cb;
fc->cb_cls = cb_cls;
GNUNET_CONTAINER_DLL_insert (ch->fc_head, ch->fc_tail, fc);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Created flow control id %lu for sender %s\n",
+ fc->id,
+ GNUNET_i2s (&fc->sender));
}
GNUNET_MQ_send (ch->mq, env);
return GNUNET_OK;
@@ -957,25 +932,6 @@ GNUNET_TRANSPORT_communicator_receive (
/* ************************* Discovery *************************** */
-/**
- * Notify transport service that an MQ became available due to an
- * "inbound" connection or because the communicator discovered the
- * presence of another peer.
- *
- * @param ch connection to transport service
- * @param peer peer with which we can now communicate
- * @param address address in human-readable format, 0-terminated, UTF-8
- * @param mtu maximum message size supported by queue, 0 if
- * sending is not supported, SIZE_MAX for no MTU
- * @param q_len number of messages that can be send through this queue
- * @param priority queue priority. Queues with highest priority should be
- * used
- * @param nt which network type does the @a address belong to?
- * @param cc what characteristics does the communicator have?
- * @param cs what is the connection status of the queue?
- * @param mq message queue of the @a peer
- * @return API handle identifying the new MQ
- */
struct GNUNET_TRANSPORT_QueueHandle *
GNUNET_TRANSPORT_communicator_mq_add (
struct GNUNET_TRANSPORT_CommunicatorHandle *ch,
@@ -1010,15 +966,6 @@ GNUNET_TRANSPORT_communicator_mq_add (
}
-/**
- * Notify transport service that an MQ was updated
- *
- * @param ch connection to transport service
- * @param qh the queue to update
- * @param q_len number of messages that can be send through this queue
- * @param priority queue priority. Queues with highest priority should be
- * used
- */
void
GNUNET_TRANSPORT_communicator_mq_update (
struct GNUNET_TRANSPORT_CommunicatorHandle *ch,
@@ -1101,6 +1048,18 @@ GNUNET_TRANSPORT_communicator_address_remove (
struct GNUNET_TRANSPORT_CommunicatorHandle *ch = ai->ch;
send_del_address (ai);
+ if (NULL == ai->prev)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "prev null\n");
+ if (ch->ai_head == ai)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "equals head\n");
+ if (NULL == ai->next)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "next null\n");
+ if (ch->ai_tail == ai)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "equals tail\n");
GNUNET_CONTAINER_DLL_remove (ch->ai_head, ch->ai_tail, ai);
GNUNET_free (ai->address);
GNUNET_free (ai);
@@ -1124,20 +1083,6 @@ GNUNET_TRANSPORT_communicator_address_remove_all (
/* ************************* Backchannel *************************** */
-/**
- * The communicator asks the transport service to route a message via
- * a different path to another communicator service at another peer.
- * This must only be done for special control traffic (as there is no
- * flow control for this API), such as acknowledgements, and generally
- * only be done if the communicator is uni-directional (i.e. cannot
- * send the message back itself).
- *
- * @param ch handle of this communicator
- * @param pid peer to send the message to
- * @param comm name of the communicator to send the message to
- * @param header header of the message to transmit and pass via the
- * notify-API to @a pid's communicator @a comm
- */
void
GNUNET_TRANSPORT_communicator_notify (
struct GNUNET_TRANSPORT_CommunicatorHandle *ch,
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c
index c7de39ea8..5b234f802 100644
--- a/src/transport/transport_api_address_to_string.c
+++ b/src/transport/transport_api_address_to_string.c
@@ -56,7 +56,7 @@ struct GNUNET_TRANSPORT_AddressToStringContext
* Function called with responses from the service.
*
* @param cls our `struct GNUNET_TRANSPORT_AddressToStringContext *`
- * @param msg message with the human-readable address
+ * @param atsm message with the human-readable address
* @return #GNUNET_OK if message is well-formed
*/
static int
@@ -97,7 +97,7 @@ check_reply (void *cls,
* Function called with responses from the service.
*
* @param cls our `struct GNUNET_TRANSPORT_AddressToStringContext *`
- * @param msg message with the human-readable address
+ * @param atsm message with the human-readable address
*/
static void
handle_reply (void *cls,
diff --git a/src/transport/transport_api_cmd_backchannel_check.c b/src/transport/transport_api_cmd_backchannel_check.c
index 4ffd96210..0376275a3 100644
--- a/src/transport/transport_api_cmd_backchannel_check.c
+++ b/src/transport/transport_api_cmd_backchannel_check.c
@@ -36,7 +36,7 @@
/**
* Generic logging shortcut
*/
-#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "udp-backchannel",__VA_ARGS__)
#define UDP "udp"
@@ -388,6 +388,8 @@ add_search_string (struct CheckState *cs, const struct
}
else
GNUNET_assert (0);
+ GNUNET_free (peer);
+ GNUNET_free (us);
}
@@ -400,17 +402,10 @@ backchannel_check_run (void *cls,
struct GNUNET_TESTING_Interpreter *is)
{
struct CheckState *cs = cls;
- // char *buf;
- // char *part_one = "Delivering backchannel message from ";
- // char *part_two = " of type 1460 to udp";
const struct GNUNET_TESTING_Command *system_cmd;
const struct GNUNET_TESTING_System *tl_system;
const struct GNUNET_TESTING_Command *peer1_cmd;
const struct GNUNET_TRANSPORT_ApplicationHandle *ah;
- // struct GNUNET_PeerIdentity *peer;
- // uint32_t num;
- // struct GNUNET_TESTING_NodeConnection *pos_connection;
- // unsigned int con_num = 0;
struct GNUNET_CONTAINER_MultiShortmapIterator *node_it;
struct GNUNET_CONTAINER_MultiShortmapIterator *namespace_it;
struct GNUNET_ShortHashCode node_key;
@@ -418,6 +413,9 @@ backchannel_check_run (void *cls,
const struct GNUNET_TESTING_NetjailNode *node;
const struct GNUNET_TESTING_NetjailNamespace *namespace;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "check run 1\n");
+
peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
cs->start_peer_label);
GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd,
@@ -434,7 +432,7 @@ backchannel_check_run (void *cls,
cs->topology);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "check run\n");
+ "check run 2\n");
node_it = GNUNET_CONTAINER_multishortmap_iterator_create (
@@ -455,6 +453,7 @@ backchannel_check_run (void *cls,
add_search_string (cs, node);
}
}
+ GNUNET_free (node_it);
namespace_it = GNUNET_CONTAINER_multishortmap_iterator_create (
cs->topology->map_namespaces);
while (GNUNET_YES == GNUNET_CONTAINER_multishortmap_iterator_next (
@@ -483,41 +482,9 @@ backchannel_check_run (void *cls,
add_search_string (cs, node);
}
}
+ GNUNET_free (node_it);
}
- /* for (pos_connection = cs->node_connections_head; NULL != pos_connection; */
- /* pos_connection = pos_connection->next) */
- /* { */
- /* if (GNUNET_YES == will_the_other_node_connect_via_udp (cs, node)) */
- /* { */
- /* num = GNUNET_TESTING_calculate_num (pos_connection, cs->topology); */
- /* peer = GNUNET_TESTING_get_pub_key (num, tl_system); */
- /* LOG (GNUNET_ERROR_TYPE_DEBUG, */
- /* "peer: %s\n", */
- /* GNUNET_i2s (peer)); */
-
- /* if (0 < GNUNET_asprintf (&buf, */
- /* "%s%s%s", */
- /* part_one, */
- /* GNUNET_i2s (peer), */
- /* part_two)) */
- /* { */
- /* GNUNET_array_append (cs->search_string, */
- /* con_num, */
- /* buf); */
- /* /\*LOG (GNUNET_ERROR_TYPE_DEBUG, */
- /* "con_num: %u search: %s %p\n", */
- /* con_num, */
- /* cs->search_string[con_num - 1], */
- /* cs->search_string);*\/ */
- /* } */
- /* else */
- /* GNUNET_assert (0); */
- /* } */
-
-
- /* } */
- // cs->con_num = con_num;
if (0 != cs->con_num)
{
cs->task =
@@ -527,6 +494,7 @@ backchannel_check_run (void *cls,
else
GNUNET_TESTING_async_finish (&cs->ac);
+ GNUNET_free (namespace_it);
}
@@ -557,18 +525,6 @@ backchannel_check_cleanup (void *cls)
}
-/**
- * Create command.
- *
- * @param label name for command.
- * @param start_peer_label Label of the cmd to start a peer.
- * @param create_label Label of the cmd to create the testing system.
- * @param num Number globally identifying the node.
- * @param node_n The number of the node in a network namespace.
- * @param namespace_n The number of the network namespace.
- * @param The topology for the test setup.
- * @return command.
- */
struct GNUNET_TESTING_Command
GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
const char *start_peer_label,
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c
index 8aba290c3..a6006f698 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -61,7 +61,6 @@ connect_peers_run (void *cls,
struct GNUNET_TESTING_AddressPrefix *pos_prefix;
unsigned int con_num = 0;
const enum GNUNET_GenericReturnValue *broadcast;
- char *port;
cps->is = is;
peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
@@ -167,17 +166,18 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
cps->con_num_notified++;
GNUNET_free (peer_connection);
}
- if (cps->con_num == con_num)
+ if (cps->con_num_notified == con_num)
cps->additional_connects_notified++;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "con_num: %u add: %u num_notified: %u add_notified: %u\n",
+ "con_num: %u add: %u num_notified: %u add_notified: %u peer: %s\n",
cps->con_num,
cps->additional_connects,
cps->con_num_notified,
- cps->additional_connects_notified);
- if (cps->con_num + cps->additional_connects == cps->con_num_notified
- + cps->additional_connects_notified)
+ cps->additional_connects_notified,
+ GNUNET_i2s (peer));
+ if ((cps->con_num == cps->con_num_notified) &&
+ (cps->additional_connects <= cps->additional_connects_notified))
{
GNUNET_TESTING_async_finish (&cps->ac);
}
@@ -220,17 +220,6 @@ connect_peers_traits (void *cls,
}
-/**
- * Create command
- *
- * @param label name for command
- * @param start_peer_label Label of the cmd to start a peer.
- * @param create_peer_label Label of the cmd which started the test system.
- * @param num Number globally identifying the node.
- * @param The topology for the test setup.
- * @param additional_connects Number of additional connects this cmd will wait for not triggered by this cmd.
- * @return command.
- */
struct GNUNET_TESTING_Command
GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
const char *start_peer_label,
@@ -241,6 +230,18 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
unsigned int additional_connects)
{
struct ConnectPeersState *cps;
+ unsigned int node_additional_connects;
+
+ node_additional_connects = GNUNET_TESTING_get_additional_connects (num,
+ topology);
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "global: %u and local: %u additional_connects\n",
+ additional_connects,
+ node_additional_connects);
+
+ if (0 != node_additional_connects)
+ additional_connects = node_additional_connects;
cps = GNUNET_new (struct ConnectPeersState);
cps->start_peer_label = start_peer_label;
diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c
index ade0cc914..c71c952aa 100644
--- a/src/transport/transport_api_cmd_send_simple.c
+++ b/src/transport/transport_api_cmd_send_simple.c
@@ -90,7 +90,8 @@ send_simple_cb (void *cls,
struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Sending simple test message\n");
+ "Sending simple test message with mq %p\n",
+ mq);
env = GNUNET_MQ_msg_extra (test,
1000 - sizeof(*test),
@@ -116,13 +117,6 @@ send_simple_run (void *cls,
struct SendSimpleState *sss = cls;
const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
const struct GNUNET_TESTING_Command *peer1_cmd;
- // struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode);
- struct GNUNET_HashCode hc;
- struct GNUNET_TESTING_NodeConnection *node_connections_head;
- struct GNUNET_PeerIdentity *peer;
- struct GNUNET_CRYPTO_EddsaPublicKey public_key;
- uint32_t num;
- struct GNUNET_TESTING_NodeConnection *pos_connection;
const struct GNUNET_TESTING_Command *system_cmd;
const struct GNUNET_TESTING_System *tl_system;
@@ -136,55 +130,13 @@ send_simple_run (void *cls,
GNUNET_TESTING_get_trait_test_system (system_cmd,
&tl_system);
- node_connections_head = GNUNET_TESTING_get_connections (sss->num,
- sss->topology);
-
GNUNET_CONTAINER_multishortmap_iterate (
(struct GNUNET_CONTAINER_MultiShortmap *)
connected_peers_map, send_simple_cb,
sss);
- /*for (int i = 0; i < 1; i++)
- {
- for (pos_connection = node_connections_head; NULL != pos_connection;
- pos_connection = pos_connection->next)
- {
- num = GNUNET_TESTING_calculate_num (pos_connection, sss->topology);
- peer = GNUNET_TESTING_get_pub_key (num, tl_system);
- public_key = peer->public_key;
- GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
-
- memcpy (key,
- &hc,
- sizeof (*key));
- mq = GNUNET_CONTAINER_multishortmap_get (connected_peers_map,
- key);
- env = GNUNET_MQ_msg_extra (test,
- 1000 - sizeof(*test),
- GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE);
- test->num = htonl (sss->num);
- memset (&test[1],
- sss->num,
- 1000 - sizeof(*test));
- GNUNET_MQ_send (mq,
- env);
- }
- }*/
-
- // GNUNET_free (key);
-
}
-/**
- * Create command.
- *
- * @param label name for command.
- * @param start_peer_label Label of the cmd to start a peer.
- * @param start_peer_label Label of the cmd which started the test system.
- * @param num Number globally identifying the node.
- * @param The topology for the test setup.
- * @return command.
- */
struct GNUNET_TESTING_Command
GNUNET_TRANSPORT_cmd_send_simple (const char *label,
const char *start_peer_label,
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index 7448eff5a..4add06609 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -129,13 +129,16 @@ notify_connect (void *cls,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"This Peer %s \n",
GNUNET_i2s (&sps->id));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Peer %s connected to peer number %u\n",
- GNUNET_i2s (peer),
- sps->no);
+
GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer %s connected to peer number %u with mq %p\n",
+ GNUNET_i2s (peer),
+ sps->no,
+ mq);
+
memcpy (key,
&hc,
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c
index 0ffaeb444..12612de09 100644
--- a/src/transport/transport_api_core.c
+++ b/src/transport/transport_api_core.c
@@ -713,7 +713,7 @@ handle_recv (void *cls, const struct InboundMessage *im)
* Function we use for handling incoming set quota messages.
*
* @param cls closure, a `struct GNUNET_TRANSPORT_CoreHandle *`
- * @param msg message received
+ * @param qm message received
*/
static void
handle_set_quota (void *cls, const struct QuotaSetMessage *qm)
diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c
index 2f0f07f23..ef1dc6087 100644
--- a/src/transport/transport_api_monitor_peers.c
+++ b/src/transport/transport_api_monitor_peers.c
@@ -389,32 +389,6 @@ do_peer_connect (void *cls)
}
-/**
- * Return information about a specific peer or all peers currently known to
- * transport service once or in monitoring mode. To obtain information about
- * a specific peer, a peer identity can be passed. To obtain information about
- * all peers currently known to transport service, NULL can be passed as peer
- * identity.
- *
- * For each peer, the callback is called with information about the address used
- * to communicate with this peer, the state this peer is currently in and the
- * the current timeout for this state.
- *
- * Upon completion, the 'GNUNET_TRANSPORT_PeerIterateCallback' is called one
- * more time with 'NULL'. After this, the operation must no longer be
- * explicitly canceled.
- *
- * The #GNUNET_TRANSPORT_monitor_peers_cancel call MUST not be called in the
- * the peer_callback!
- *
- * @param cfg configuration to use
- * @param peer a specific peer identity to obtain information for,
- * NULL for all peers
- * @param one_shot #GNUNET_YES to return the current state and then end (with NULL+NULL),
- * #GNUNET_NO to monitor peers continuously
- * @param peer_callback function to call with the results
- * @param peer_callback_cls closure for @a peer_address_callback
- */
struct GNUNET_TRANSPORT_PeerMonitoringContext *
GNUNET_TRANSPORT_monitor_peers (const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_PeerIdentity *peer,
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c
index d8eddddaa..43a11442b 100644
--- a/src/transport/transport_api_monitor_plugins.c
+++ b/src/transport/transport_api_monitor_plugins.c
@@ -211,7 +211,7 @@ locate_by_id (void *cls,
* Function called with responses from the service.
*
* @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- * @paramm tpmm message with event data
+ * @param tpmm message with event data
* @return #GNUNET_Ok if message is well-formed
*/
static int
@@ -243,7 +243,7 @@ check_event (void *cls,
* Function called with responses from the service.
*
* @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *`
- * @paramm tpmm message with event data
+ * @param tpmm message with event data
*/
static void
handle_event (void *cls,
diff --git a/src/transport/transport_api_offer_hello.c b/src/transport/transport_api_offer_hello.c
index eb342f57c..1b611aa6b 100644
--- a/src/transport/transport_api_offer_hello.c
+++ b/src/transport/transport_api_offer_hello.c
@@ -125,11 +125,6 @@ GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg,
}
-/**
- * Cancel the request to transport to offer the HELLO message
- *
- * @param ohh the handle for the operation to cancel
- */
void
GNUNET_TRANSPORT_offer_hello_cancel (struct
GNUNET_TRANSPORT_OfferHelloHandle *ohh)