gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: misc bugfixes


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: misc bugfixes
Date: Tue, 04 Jun 2019 20:55:05 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 2cce8be6b misc bugfixes
2cce8be6b is described below

commit 2cce8be6b8fcb2baa0d7abde4bbe486cbcb3f983
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Jun 4 20:54:16 2019 +0200

    misc bugfixes
---
 src/cadet/gnunet-service-cadet_channel.c      |   1 +
 src/identity/gnunet-identity.c                |   2 +-
 src/json/test_json_mhd.c                      |   1 -
 src/transport/gnunet-communicator-tcp.c       |   9 --
 src/transport/gnunet-communicator-udp.c       |  77 ++++-------
 src/transport/gnunet-communicator-unix.c      |   4 +-
 src/transport/gnunet-service-tng.c            |  35 +++--
 src/transport/test_transport_address_switch.c | 176 +++++++++++++-------------
 8 files changed, 140 insertions(+), 165 deletions(-)

diff --git a/src/cadet/gnunet-service-cadet_channel.c 
b/src/cadet/gnunet-service-cadet_channel.c
index bd95428be..a1f6e37c2 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -1472,6 +1472,7 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel 
*ch,
                                 1,
                                 GNUNET_NO);
       drop = ccc->head_recv;
+      GNUNET_assert (NULL != drop);
       GNUNET_CONTAINER_DLL_remove (ccc->head_recv,
                                    ccc->tail_recv,
                                    drop);
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index e22ac9106..4d6b1db3f 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -291,7 +291,7 @@ print_ego (void *cls,
   }
   if (! (list | monitor))
     return;
-  if (NULL == ego)
+  if ( (NULL == ego) || (NULL == identifier) )
     return;
   if ((NULL != set_ego) && (0 != strcmp (identifier, set_ego)))
     return;
diff --git a/src/json/test_json_mhd.c b/src/json/test_json_mhd.c
index 13338b32c..73efc4d97 100644
--- a/src/json/test_json_mhd.c
+++ b/src/json/test_json_mhd.c
@@ -144,7 +144,6 @@ main (int argc, const char *const argv[])
   {
     GNUNET_break (0);
     MHD_stop_daemon (daemon);
-    GNUNET_free (url);
     json_decref (bigj);
     GNUNET_free (post_data);
     GNUNET_free (str);
diff --git a/src/transport/gnunet-communicator-tcp.c 
b/src/transport/gnunet-communicator-tcp.c
index 8ab99700c..50264cf45 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -1909,15 +1909,6 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity 
*peer, const char *address)
                                    queue->sock,
                                    &queue_read_kx,
                                    queue);
-  if (NULL == queue)
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Failed to setup queue to %s at `%s'\n",
-                GNUNET_i2s (peer),
-                path);
-    GNUNET_NETWORK_socket_close (sock);
-    return GNUNET_NO;
-  }
   start_initial_kx_out (queue);
   return GNUNET_OK;
 }
diff --git a/src/transport/gnunet-communicator-udp.c 
b/src/transport/gnunet-communicator-udp.c
index 1c2063d58..6193b9225 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1043,7 +1043,7 @@ check_timeouts (void *cls)
   st = GNUNET_TIME_UNIT_FOREVER_REL;
   while (NULL != (sender = GNUNET_CONTAINER_heap_peek (senders_heap)))
   {
-    st = GNUNET_TIME_absolute_get_remaining (receiver->timeout);
+    st = GNUNET_TIME_absolute_get_remaining (sender->timeout);
     if (0 != st.rel_value_us)
       break;
     sender_destroy (sender);
@@ -2112,51 +2112,6 @@ setup_receiver_mq (struct ReceiverAddress *receiver)
 }
 
 
-/**
- * Setup a receiver for transmission.  Setup the MQ processing and
- * inform transport that the queue is ready.
- *
- * @param target which peer are we talking to
- * @param address address of the peer
- * @param address_len number of bytes in @a address
- * @return handle for the address
- */
-static struct ReceiverAddress *
-receiver_setup (const struct GNUNET_PeerIdentity *target,
-                const struct sockaddr *address,
-                socklen_t address_len)
-{
-  struct ReceiverAddress *receiver;
-
-  receiver = GNUNET_new (struct ReceiverAddress);
-  receiver->address = GNUNET_memdup (address, address_len);
-  receiver->address_len = address_len;
-  receiver->target = *target;
-  receiver->nt = GNUNET_NT_scanner_get_type (is, address, address_len);
-  (void) GNUNET_CONTAINER_multipeermap_put (
-    receivers,
-    &receiver->target,
-    receiver,
-    GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
-  receiver->timeout =
-    GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
-  receiver->hn = GNUNET_CONTAINER_heap_insert (receivers_heap,
-                                               receiver,
-                                               receiver->timeout.abs_value_us);
-  GNUNET_STATISTICS_set (stats,
-                         "# receivers active",
-                         GNUNET_CONTAINER_multipeermap_size (receivers),
-                         GNUNET_NO);
-  receiver->foreign_addr =
-    sockaddr_to_udpaddr_string (receiver->address, receiver->address_len);
-  setup_receiver_mq (receiver);
-
-  if (NULL == timeout_task)
-    timeout_task = GNUNET_SCHEDULER_add_now (&check_timeouts, NULL);
-  return receiver;
-}
-
-
 /**
  * Function called by the transport service to initialize a
  * message queue given address information about another peer.
@@ -2192,8 +2147,30 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity 
*peer, const char *address)
   }
   path = &address[strlen (COMMUNICATOR_ADDRESS_PREFIX "-")];
   in = udp_address_to_sockaddr (path, &in_len);
-  receiver = receiver_setup (peer, in, in_len);
-  (void) receiver;
+
+  receiver = GNUNET_new (struct ReceiverAddress);
+  receiver->address = in;
+  receiver->address_len = in_len;
+  receiver->target = *peer;
+  receiver->nt = GNUNET_NT_scanner_get_type (is, in, in_len);
+  (void) GNUNET_CONTAINER_multipeermap_put (receivers,
+                                            &receiver->target,
+                                            receiver,
+                                            
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
+  receiver->timeout =
+    GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+  receiver->hn = GNUNET_CONTAINER_heap_insert (receivers_heap,
+                                               receiver,
+                                               receiver->timeout.abs_value_us);
+  GNUNET_STATISTICS_set (stats,
+                         "# receivers active",
+                         GNUNET_CONTAINER_multipeermap_size (receivers),
+                         GNUNET_NO);
+  receiver->foreign_addr =
+    sockaddr_to_udpaddr_string (receiver->address, receiver->address_len);
+  setup_receiver_mq (receiver);
+  if (NULL == timeout_task)
+    timeout_task = GNUNET_SCHEDULER_add_now (&check_timeouts, NULL);
   return GNUNET_OK;
 }
 
@@ -2489,14 +2466,14 @@ iface_proc (void *cls,
 
   (void) cls;
   (void) netmask;
+  if (NULL == addr)
+    return GNUNET_YES; /* need to know our address! */
   network = GNUNET_NT_scanner_get_type (is, addr, addrlen);
   if (GNUNET_NT_LOOPBACK == network)
   {
     /* Broadcasting on loopback does not make sense */
     return GNUNET_YES;
   }
-  if (NULL == addr)
-    return GNUNET_YES; /* need to know our address! */
   for (bi = bi_head; NULL != bi; bi = bi->next)
   {
     if ((bi->salen == addrlen) && (0 == memcmp (addr, bi->sa, addrlen)))
diff --git a/src/transport/gnunet-communicator-unix.c 
b/src/transport/gnunet-communicator-unix.c
index 642703f29..9bbc02c65 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -417,6 +417,7 @@ select_write_cb (void *cls)
   struct Queue *queue = queue_tail;
   const struct GNUNET_MessageHeader *msg = queue->msg;
   size_t msg_size = ntohs (msg->size);
+  const void *msg;
   ssize_t sent;
 
   /* take queue of the ready list */
@@ -432,12 +433,13 @@ select_write_cb (void *cls)
                                      NULL);
 
   /* send 'msg' */
+  msg = queue->msg;
   queue->msg = NULL;
   GNUNET_MQ_impl_send_continue (queue->mq);
  resend:
   /* Send the data */
   sent = GNUNET_NETWORK_socket_sendto (unix_sock,
-                                       queue->msg,
+                                       msg,
                                        msg_size,
                                        (const struct sockaddr *) 
queue->address,
                                        queue->address_len);
diff --git a/src/transport/gnunet-service-tng.c 
b/src/transport/gnunet-service-tng.c
index 7cc9f193c..9262e5e97 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -2980,7 +2980,8 @@ free_virtual_link (struct VirtualLink *vl)
 
   while (NULL != (pm = vl->pending_msg_head))
     free_pending_message (pm);
-  GNUNET_CONTAINER_multipeermap_remove (links, &vl->target, vl);
+  GNUNET_assert (GNUNET_YES ==
+                 GNUNET_CONTAINER_multipeermap_remove (links, &vl->target, 
vl));
   if (NULL != vl->visibility_task)
   {
     GNUNET_SCHEDULER_cancel (vl->visibility_task);
@@ -3006,7 +3007,9 @@ free_virtual_link (struct VirtualLink *vl)
 static void
 free_validation_state (struct ValidationState *vs)
 {
-  GNUNET_CONTAINER_multipeermap_remove (validation_map, &vs->pid, vs);
+  GNUNET_assert (
+    GNUNET_YES ==
+    GNUNET_CONTAINER_multipeermap_remove (validation_map, &vs->pid, vs));
   GNUNET_CONTAINER_heap_remove_node (vs->hn);
   vs->hn = NULL;
   if (NULL != vs->sc)
@@ -4650,6 +4653,7 @@ route_control_message_without_fc (const struct 
GNUNET_PeerIdentity *target,
   struct DistanceVector *dv;
 
   vl = lookup_virtual_link (target);
+  GNUNET_assert (NULL != vl);
   n = vl->n;
   dv = (0 != (options & RMO_DV_ALLOWED)) ? vl->dv : NULL;
   if (0 == (options & RMO_UNCONFIRMED_ALLOWED))
@@ -5101,6 +5105,7 @@ handle_del_address (void *cls,
                     const struct GNUNET_TRANSPORT_DelAddressMessage *dam)
 {
   struct TransportClient *tc = cls;
+  struct AddressListEntry *alen;
 
   if (CT_COMMUNICATOR != tc->type)
   {
@@ -5110,8 +5115,9 @@ handle_del_address (void *cls,
   }
   for (struct AddressListEntry *ale = tc->details.communicator.addr_head;
        NULL != ale;
-       ale = ale->next)
+       ale = alen)
   {
+    alen = ale->next;
     if (dam->aid != ale->aid)
       continue;
     GNUNET_assert (ale->tc == tc);
@@ -5515,10 +5521,10 @@ handle_fragment_box (void *cls, const struct 
TransportFragmentBoxMessage *fb)
   msize = ntohs (fb->msg_size);
   fc.message_uuid = fb->msg_uuid;
   fc.rc = NULL;
-  GNUNET_CONTAINER_multihashmap32_get_multiple (n->reassembly_map,
-                                                fb->msg_uuid.uuid,
-                                                &find_by_message_uuid,
-                                                &fc);
+  (void) GNUNET_CONTAINER_multihashmap32_get_multiple (n->reassembly_map,
+                                                       fb->msg_uuid.uuid,
+                                                       &find_by_message_uuid,
+                                                       &fc);
   if (NULL == (rc = fc.rc))
   {
     rc = GNUNET_malloc (sizeof (*rc) + msize + /* reassembly payload buffer */
@@ -7756,6 +7762,7 @@ handle_validation_challenge (
   struct GNUNET_TIME_RelativeNBO validity_duration;
   struct IncomingRequest *ir;
   struct Neighbour *n;
+  struct GNUNET_PeerIdentity sender;
 
   /* DV-routed messages are not allowed for validation challenges */
   if (cmc->total_hops > 0)
@@ -7794,9 +7801,9 @@ handle_validation_challenge (
   route_control_message_without_fc (&cmc->im.sender,
                                     &tvr.header,
                                     RMO_ANYTHING_GOES | RMO_REDUNDANT);
+  sender = cmc->im.sender;
   finish_cmc_handling (cmc);
-
-  vl = lookup_virtual_link (&cmc->im.sender);
+  vl = lookup_virtual_link (&sender);
   if (NULL != vl)
     return;
 
@@ -7805,17 +7812,17 @@ handle_validation_challenge (
      CORE), so we must try to bring the link up! */
 
   /* (1) Check existing queues, if any, we may be lucky! */
-  n = lookup_neighbour (&cmc->im.sender);
+  n = lookup_neighbour (&sender);
   if (NULL != n)
     for (struct Queue *q = n->queue_head; NULL != q; q = q->next_neighbour)
-      start_address_validation (&cmc->im.sender, q->address);
+      start_address_validation (&sender, q->address);
   /* (2) Also try to see if we have addresses in PEERSTORE for this peer
      we could use */
   for (ir = ir_head; NULL != ir; ir = ir->next)
-    if (0 == GNUNET_memcmp (&ir->pid, &cmc->im.sender))
+    if (0 == GNUNET_memcmp (&ir->pid, &sender))
       return; /* we are already trying */
   ir = GNUNET_new (struct IncomingRequest);
-  ir->pid = cmc->im.sender;
+  ir->pid = sender;
   GNUNET_CONTAINER_DLL_insert (ir_head, ir_tail, ir);
   ir->wc = GNUNET_PEERSTORE_watch (peerstore,
                                    "transport",
@@ -9190,6 +9197,7 @@ suggest_to_connect (const struct GNUNET_PeerIdentity 
*pid, const char *address)
                 "Cannot connect to %s at `%s', no matching communicator 
present\n",
                 GNUNET_i2s (pid),
                 address);
+    GNUNET_free (prefix);
     return;
   }
   /* forward suggestion for queue creation to communicator */
@@ -9198,6 +9206,7 @@ suggest_to_connect (const struct GNUNET_PeerIdentity 
*pid, const char *address)
               (unsigned int) idgen,
               prefix,
               address);
+  GNUNET_free (prefix);
   alen = strlen (address) + 1;
   env =
     GNUNET_MQ_msg_extra (cqm, alen, 
GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE);
diff --git a/src/transport/test_transport_address_switch.c 
b/src/transport/test_transport_address_switch.c
index fa977a364..98f1170ff 100644
--- a/src/transport/test_transport_address_switch.c
+++ b/src/transport/test_transport_address_switch.c
@@ -93,9 +93,7 @@ stat_start_attempt_cb (void *cls,
   struct PeerStats *stat = cls;
 
   stat->switch_attempts++;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Switch attempted (%p)",
-              stat);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Switch attempted (%p)", stat);
   bytes_recv_after_switch = 0;
   bytes_sent_after_switch = 0;
 
@@ -113,9 +111,7 @@ stat_success_attempt_cb (void *cls,
   struct PeerStats *stat = cls;
 
   stat->switch_success++;
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Switch succeeded (%p)",
-              stat);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Switch succeeded (%p)", stat);
   return GNUNET_OK;
 }
 
@@ -133,9 +129,7 @@ stat_fail_attempt_cb (void *cls,
     return GNUNET_OK;
 
   stat->switch_fail++;
-  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-              "Switch failed (%p)",
-              stat);
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Switch failed (%p)", stat);
   return GNUNET_OK;
 }
 
@@ -157,7 +151,8 @@ stat_addresses_available (void *cls,
 /**
  * List of statistics entries we care about.
  */
-static struct WatchEntry {
+static struct WatchEntry
+{
 
   /**
    * Name of the statistic we watch.
@@ -168,15 +163,17 @@ static struct WatchEntry {
    * Handler to register;
    */
   GNUNET_STATISTICS_Iterator stat_handler;
-} watches[] = {
-  { "# Attempts to switch addresses", &stat_start_attempt_cb },
-  { "# Successful attempts to switch addresses", &stat_success_attempt_cb },
-  { "# Failed attempts to switch addresses (failed to send CONNECT CONT)", 
&stat_fail_attempt_cb },
-  { "# Failed attempts to switch addresses (failed to send CONNECT)", 
&stat_fail_attempt_cb },
-  { "# Failed attempts to switch addresses (no response)", 
&stat_fail_attempt_cb },
-  { "# transport addresses", &stat_addresses_available },
-  { NULL, NULL }
-};
+} watches[] =
+  {{"# Attempts to switch addresses", &stat_start_attempt_cb},
+   {"# Successful attempts to switch addresses", &stat_success_attempt_cb},
+   {"# Failed attempts to switch addresses (failed to send CONNECT CONT)",
+    &stat_fail_attempt_cb},
+   {"# Failed attempts to switch addresses (failed to send CONNECT)",
+    &stat_fail_attempt_cb},
+   {"# Failed attempts to switch addresses (no response)",
+    &stat_fail_attempt_cb},
+   {"# transport addresses", &stat_addresses_available},
+   {NULL, NULL}};
 
 
 static void
@@ -203,19 +200,18 @@ custom_shutdown (void *cls)
   }
 
   /* stop statistics */
-  for (unsigned int i=0;i<2;i++)
+  for (unsigned int i = 0; i < 2; i++)
   {
     if (NULL != stats[i].stat)
     {
-      for (unsigned int j=0;NULL != watches[j].stat_name; j++)
-        GNUNET_STATISTICS_watch_cancel (stats[i].stat,
-                                        "transport",
-                                        watches[j].stat_name,
-                                        watches[j].stat_handler,
-                                        &stats[i]);
-
-      GNUNET_STATISTICS_destroy (stats[i].stat,
-                                 GNUNET_NO);
+      for (unsigned int j = 0; NULL != watches[j].stat_name; j++)
+        GNUNET_assert (GNUNET_OK ==
+                       GNUNET_STATISTICS_watch_cancel (stats[i].stat,
+                                                       "transport",
+                                                       watches[j].stat_name,
+                                                       watches[j].stat_handler,
+                                                       &stats[i]));
+      GNUNET_STATISTICS_destroy (stats[i].stat, GNUNET_NO);
       stats[i].stat = NULL;
     }
   }
@@ -224,15 +220,16 @@ custom_shutdown (void *cls)
   FPRINTF (stderr, "\n");
   if (stats[0].switch_attempts > 0)
   {
-    FPRINTF (stderr,
-             "Peer 1 tried %u times to switch and succeeded %u times, failed 
%u times\n",
-             stats[0].switch_attempts,
-             stats[0].switch_success,
-             stats[0].switch_fail);
+    FPRINTF (
+      stderr,
+      "Peer 1 tried %u times to switch and succeeded %u times, failed %u 
times\n",
+      stats[0].switch_attempts,
+      stats[0].switch_success,
+      stats[0].switch_fail);
     if (stats[0].switch_success != stats[0].switch_attempts)
     {
       GNUNET_break (0);
-      result ++;
+      result++;
     }
   }
   else if (stats[0].addresses_avail > 1)
@@ -243,11 +240,12 @@ custom_shutdown (void *cls)
   }
   if (stats[1].switch_attempts > 0)
   {
-    FPRINTF (stderr,
-             "Peer 2 tried %u times to switch and succeeded %u times, failed 
%u times\n",
-             stats[1].switch_attempts,
-             stats[1].switch_success,
-             stats[1].switch_fail);
+    FPRINTF (
+      stderr,
+      "Peer 2 tried %u times to switch and succeeded %u times, failed %u 
times\n",
+      stats[1].switch_attempts,
+      stats[1].switch_success,
+      stats[1].switch_fail);
     if (stats[1].switch_success != stats[1].switch_attempts)
     {
       GNUNET_break (0);
@@ -261,19 +259,17 @@ custom_shutdown (void *cls)
              stats[1].addresses_avail);
   }
 
-  if ( ((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) &&
-       (bytes_sent_after_switch == 0) )
+  if (((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) &&
+      (bytes_sent_after_switch == 0))
   {
-    FPRINTF (stderr,
-            "No data sent after switching!\n");
+    FPRINTF (stderr, "No data sent after switching!\n");
     GNUNET_break (0);
     result++;
   }
-  if ( ((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) &&
-       (bytes_recv_after_switch == 0) )
+  if (((stats[0].switch_attempts > 0) || (stats[1].switch_attempts > 0)) &&
+      (bytes_recv_after_switch == 0))
   {
-    FPRINTF (stderr,
-            "No data received after switching!\n");
+    FPRINTF (stderr, "No data received after switching!\n");
     GNUNET_break (0);
     result++;
   }
@@ -306,13 +302,14 @@ notify_receive (void *cls,
                 GNUNET_i2s (sender));
     GNUNET_free (ps);
   }
-  if ( ((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) &&
-        (stats[0].switch_attempts == stats[0].switch_fail + 
stats[0].switch_success) &&
-        (stats[1].switch_attempts == stats[1].switch_fail + 
stats[1].switch_success) )
+  if (((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) &&
+      (stats[0].switch_attempts ==
+       stats[0].switch_fail + stats[0].switch_success) &&
+      (stats[1].switch_attempts ==
+       stats[1].switch_fail + stats[1].switch_success))
   {
-    bytes_recv_after_switch += ntohs(hdr->header.size);
-    if ( (bytes_sent_after_switch > 0) &&
-        (bytes_recv_after_switch > 0) )
+    bytes_recv_after_switch += ntohs (hdr->header.size);
+    if ((bytes_sent_after_switch > 0) && (bytes_recv_after_switch > 0))
     {
       /* A peer switched addresses and sent and received data after the
        * switch operations */
@@ -327,21 +324,22 @@ notify_send (void *cls)
 {
   static uint32_t cnt;
 
-  GNUNET_assert (GNUNET_OK ==
-                GNUNET_TRANSPORT_TESTING_send (ccc->p[1],
-                                               ccc->p[0],
-                                               
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
-                                               
GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE,
-                                               ++cnt,
-                                               &notify_send,
-                                               NULL));
-  if ( ( (stats[0].switch_attempts >= 1) ||
-         (stats[1].switch_attempts >= 1) ) &&
-       (stats[0].switch_attempts == stats[0].switch_fail + 
stats[0].switch_success) &&
-       (stats[1].switch_attempts == stats[1].switch_fail + 
stats[1].switch_success) )
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_TRANSPORT_TESTING_send (ccc->p[1],
+                                   ccc->p[0],
+                                   GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
+                                   GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE,
+                                   ++cnt,
+                                   &notify_send,
+                                   NULL));
+  if (((stats[0].switch_attempts >= 1) || (stats[1].switch_attempts >= 1)) &&
+      (stats[0].switch_attempts ==
+       stats[0].switch_fail + stats[0].switch_success) &&
+      (stats[1].switch_attempts ==
+       stats[1].switch_fail + stats[1].switch_success))
   {
-    bytes_sent_after_switch
-      += GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE;
+    bytes_sent_after_switch += GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE;
   }
 }
 
@@ -370,10 +368,9 @@ progress_indicator (void *cls)
 static void
 connected_cb (void *cls)
 {
-  for (unsigned int i=0;i<2;i++)
+  for (unsigned int i = 0; i < 2; i++)
   {
-    stats[i].stat = GNUNET_STATISTICS_create ("transport",
-                                              ccc->p[i]->cfg);
+    stats[i].stat = GNUNET_STATISTICS_create ("transport", ccc->p[i]->cfg);
     if (NULL == stats[i].stat)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -382,7 +379,7 @@ connected_cb (void *cls)
       GNUNET_SCHEDULER_shutdown ();
       return;
     }
-    for (unsigned int j=0;NULL != watches[j].stat_name; j++)
+    for (unsigned int j = 0; NULL != watches[j].stat_name; j++)
     {
       GNUNET_STATISTICS_watch (stats[i].stat,
                                "transport",
@@ -397,29 +394,28 @@ connected_cb (void *cls)
                                                &progress_indicator,
                                                NULL);
   /* Peers are connected, start transmit test messages */
-  GNUNET_assert (GNUNET_OK ==
-                GNUNET_TRANSPORT_TESTING_send (ccc->p[1],
-                                               ccc->p[0],
-                                               
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
-                                               
GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE,
-                                               0,
-                                               &notify_send,
-                                               NULL));
+  GNUNET_assert (
+    GNUNET_OK ==
+    GNUNET_TRANSPORT_TESTING_send (ccc->p[1],
+                                   ccc->p[0],
+                                   GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
+                                   GNUNET_TRANSPORT_TESTING_LARGE_MESSAGE_SIZE,
+                                   0,
+                                   &notify_send,
+                                   NULL));
 }
 
 
 int
-main (int argc,
-      char *argv[])
+main (int argc, char *argv[])
 {
-  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
-    .connect_continuation = &connected_cb,
-    .config_file = "test_transport_api_data.conf",
-    .rec = &notify_receive,
-    .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
-    .shutdown_task = &custom_shutdown,
-    .timeout = TIMEOUT
-  };
+  struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc =
+    {.connect_continuation = &connected_cb,
+     .config_file = "test_transport_api_data.conf",
+     .rec = &notify_receive,
+     .nc = &GNUNET_TRANSPORT_TESTING_log_connect,
+     .shutdown_task = &custom_shutdown,
+     .timeout = TIMEOUT};
   ccc = &my_ccc;
   int ret;
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]