rt = GNUNET_TIME_absolute_get_remaining (receiver->timeout);
if (0 != rt.rel_value_us)
break;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Receiver timed out\n");
receiver_destroy (receiver);
}
st = GNUNET_TIME_UNIT_FOREVER_REL;
{
const struct UDPAck *ack = cls;
struct ReceiverAddress *receiver = value;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "in handle ack\n");
(void) pid;
for (struct SharedSecret *ss = receiver->ss_head; NULL != ss; ss = ss->next)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Checking shared secrets\n");
if (0 == memcmp (&ack->cmac, &ss->cmac, sizeof(struct GNUNET_HashCode)))
{
uint32_t allowed;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Found matching mac\n");
allowed = ntohl (ack->sequence_max);
if (allowed > ss->sequence_allowed)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u > %u (%u)\n", allowed, ss->sequence_allowed,
+ receiver->acks_available);
+
receiver->acks_available += (allowed - ss->sequence_allowed);
if ((allowed - ss->sequence_allowed) == receiver->acks_available)
{
/* we just incremented from zero => MTU change! */
- setup_receiver_mq (receiver);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "we just incremented from zero => MTU change!\n");
+ //TODO setup_receiver_mq (receiver);
}
ss->sequence_allowed = allowed;
/* move ss to head to avoid discarding it anytime soon! */
ack.header.size = htons (sizeof(ack));
ack.sequence_max = htonl (ss->sequence_allowed);
ack.cmac = ss->cmac;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Notifying transport of UDPAck %s\n",
+ GNUNET_i2s_full (&ss->sender->target));
GNUNET_TRANSPORT_communicator_notify (ch,
&ss->sender->target,
COMMUNICATOR_ADDRESS_PREFIX,
mq_destroy (struct GNUNET_MQ_Handle *mq, void *impl_state)
{
struct ReceiverAddress *receiver = impl_state;
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MQ destroyed\n");
if (mq == receiver->mq)
{
receiver->mq = NULL;
- receiver_destroy (receiver);
+ //receiver_destroy (receiver);
}
}
GNUNET_TRANSPORT_communicator_mq_del (receiver->qh);
receiver->qh = NULL;
}
- GNUNET_assert (NULL == receiver->mq);
+ //GNUNET_assert (NULL == receiver->mq);
switch (receiver->address->sa_family)
{
case AF_INET:
&receiver->target,
receiver,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Added %s to receivers\n",
+ GNUNET_i2s_full (&receiver->target));
receiver->timeout =
GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
receiver->hn = GNUNET_CONTAINER_heap_insert (receivers_heap,
const struct UDPAck *ack;
(void) cls;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Storing UDPAck received from backchannel from %s\n",
+ GNUNET_i2s_full (sender));
if ((ntohs (msg->type) != GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK) ||
(ntohs (msg->size) != sizeof(struct UDPAck)))
{
#define LONG_MESSAGE_SIZE 32000
-#define BURST_PACKETS 5000
+#define BURST_PACKETS 50
-#define TOTAL_ITERATIONS 5
+#define TOTAL_ITERATIONS 1
#define PEER_A 0
timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
}
+static int test_prepared = GNUNET_NO;
+
+/**
+ * This helps establishing the backchannel
+ */
+static void
+prepare_test (void *cls)
+{
+ char *payload;
+
+ if (GNUNET_YES == test_prepared)
+ {
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &short_test,
+ NULL);
+ return;
+ }
+ test_prepared = GNUNET_YES;
+ payload = make_payload (SHORT_MESSAGE_SIZE);
+ GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
+ &prepare_test,
+ NULL,
+ payload,
+ SHORT_MESSAGE_SIZE);
+ GNUNET_free (payload);
+}
+
+
/**
* @brief Handle opening of queue
to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&latency_timeout,
NULL);
- short_test (NULL);
+ prepare_test (NULL);
}
"transport",
communicator_binary,
cfg_peers_name[i],
+ &peer_id[i],
&communicator_available_cb,
&add_address_cb,
&queue_create_reply_cb,
*/
char *cfg_filename;
+ struct GNUNET_PeerIdentity peer_id;
+
/**
* @brief Handle to the transport service
*/
struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
struct GNUNET_MQ_Envelope *env;
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received backchannel message\n");
if (tc_h->bc_enabled != GNUNET_YES)
{
GNUNET_SERVICE_client_continue (client->client);
cbi,
isize,
GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING);
- cbi->pid = bc_msg->pid;
+ cbi->pid = tc_h->peer_id;
memcpy (&cbi[1], msg, isize);
const char *service_name,
const char *binary_name,
const char *cfg_filename,
+ const struct GNUNET_PeerIdentity *peer_id,
GNUNET_TRANSPORT_TESTING_CommunicatorAvailableCallback
communicator_available_cb,
GNUNET_TRANSPORT_TESTING_AddAddressCallback add_address_cb,
tc_h->add_queue_cb = add_queue_cb;
tc_h->incoming_msg_cb = incoming_message_cb;
tc_h->bc_cb = bc_cb;
+ tc_h->peer_id = *peer_id;
tc_h->cb_cls = cb_cls;
/* Start communicator part of service */
struct GNUNET_MQ_Envelope *env;
size_t inbox_size;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending message\n");
inbox_size = sizeof (struct GNUNET_MessageHeader) + payload_size;
env = GNUNET_MQ_msg_extra (msg,
inbox_size,