gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34993 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r34993 - gnunet/src/transport
Date: Sun, 25 Jan 2015 22:08:22 +0100

Author: grothoff
Date: 2015-01-25 22:08:22 +0100 (Sun, 25 Jan 2015)
New Revision: 34993

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_ats.c
   gnunet/src/transport/gnunet-service-transport_ats.h
   gnunet/src/transport/gnunet-service-transport_neighbours.c
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/plugin_transport_wlan.c
   gnunet/src/transport/test_transport_api_reliability.c
Log:
-undo bad commit

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2015-01-25 21:07:24 UTC 
(rev 34992)
+++ gnunet/src/transport/gnunet-service-transport.c     2015-01-25 21:08:22 UTC 
(rev 34993)
@@ -732,15 +732,11 @@
               session,
               GNUNET_i2s (&address->peer),
               GST_plugins_a2s (address));
-  if ( (GNUNET_YES ==
-        GNUNET_HELLO_address_check_option (address,
-                                           GNUNET_HELLO_ADDRESS_INFO_INBOUND)) 
||
-       (GNUNET_NO ==
-        GST_ats_is_known (address, session) ) )
+  if (GNUNET_YES ==
+      GNUNET_HELLO_address_check_option (address,
+                                         GNUNET_HELLO_ADDRESS_INFO_INBOUND))
   {
-    /* inbound is always new, but outbound MAY already be known, but
-       for example for UNIX, we have symmetric connections and thus we
-       may not know the address yet; add if necessary! */
+    /* inbound is always new */
     GST_ats_add_address (address,
                          session,
                          ats,
@@ -748,6 +744,7 @@
   }
   else
   {
+    /* outbound should already be known */
     GST_ats_new_session (address,
                          session);
     GST_ats_update_metrics (address,
@@ -926,8 +923,8 @@
                const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GST_neighbours_stop ();
+  GST_validation_stop ();
   GST_plugins_unload ();
-  GST_validation_stop ();
   GST_ats_done ();
   GNUNET_ATS_scheduling_done (GST_ats);
   GST_ats = NULL;

Modified: gnunet/src/transport/gnunet-service-transport_ats.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.c 2015-01-25 21:07:24 UTC 
(rev 34992)
+++ gnunet/src/transport/gnunet-service-transport_ats.c 2015-01-25 21:08:22 UTC 
(rev 34993)
@@ -108,8 +108,6 @@
     fc->ret = ai;
     return GNUNET_NO;
   }
-  GNUNET_assert ( (fc->session != ai->session) ||
-                  (NULL == ai->session) );
   return GNUNET_YES;
 }
 
@@ -140,21 +138,6 @@
 
 
 /**
- * Test if ATS knows about this address.
- *
- * @param address the address
- * @param session the session
- * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
-                  struct Session *session)
-{
-  return (NULL != find_ai (address, session)) ? GNUNET_YES : GNUNET_NO;
-}
-
-
-/**
  * Notify ATS about the new address including the network this address is
  * located in.
  *
@@ -200,7 +183,7 @@
   if (NULL == (papi = GST_plugins_find (address->transport_name)))
   {
     /* we don't have the plugin for this address */
-    GNUNET_assert (0);
+    GNUNET_break(0);
     return;
   }
   if (NULL != session)
@@ -261,12 +244,7 @@
   ai = find_ai (address, NULL);
   if (NULL == ai)
   {
-    /* We may already be aware of the session, even if some other part
-       of the code could not tell if it just created a new session or
-       just got one recycled from the plugin; hence, we may be called
-       with "new" session even for an "old" session; in that case,
-       check that this is the case, but just ignore it. */
-    GNUNET_assert (NULL != (find_ai (address, session)));
+    GNUNET_break (NULL != (find_ai (address, session)));
     return;
   }
   GNUNET_break (NULL == ai->session);
@@ -352,9 +330,9 @@
        and if we get metrics for those, they were never known to
        ATS which means we end up here (however, in this
        case, the address must be an outbound address). */
-    GNUNET_assert (GNUNET_YES !=
-                   GNUNET_HELLO_address_check_option (address,
-                                                      
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
+    GNUNET_break (GNUNET_YES !=
+                  GNUNET_HELLO_address_check_option (address,
+                                                     
GNUNET_HELLO_ADDRESS_INFO_INBOUND));
 
     return;
   }
@@ -416,7 +394,7 @@
   ai = find_ai (address, NULL);
   if (NULL == ai)
   {
-    GNUNET_assert (0);
+    GNUNET_break (0);
     return;
   }
   GNUNET_assert (GNUNET_YES ==

Modified: gnunet/src/transport/gnunet-service-transport_ats.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.h 2015-01-25 21:07:24 UTC 
(rev 34992)
+++ gnunet/src/transport/gnunet-service-transport_ats.h 2015-01-25 21:08:22 UTC 
(rev 34993)
@@ -51,17 +51,6 @@
 
 
 /**
- * Test if ATS knows about this address.
- *
- * @param address the address
- * @param session the session
- * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
-                  struct Session *session);
-
-/**
  * Notify ATS about the new address including the network this address is
  * located in.
  *

Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c  2015-01-25 
21:07:24 UTC (rev 34992)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c  2015-01-25 
21:08:22 UTC (rev 34993)
@@ -800,11 +800,11 @@
  */
 static void
 set_primary_address (struct NeighbourMapEntry *n,
-                     const struct GNUNET_HELLO_Address *address,
-                     struct Session *session,
-                     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-                     struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-                     int is_active)
+            const struct GNUNET_HELLO_Address *address,
+            struct Session *session,
+            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+            struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+            int is_active)
 {
   struct GNUNET_TRANSPORT_PluginFunctions *papi;
 

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2015-01-25 21:07:24 UTC (rev 
34992)
+++ gnunet/src/transport/plugin_transport_tcp.c 2015-01-25 21:08:22 UTC (rev 
34993)
@@ -2261,9 +2261,8 @@
   struct GNUNET_ATS_Information ats;
 
 
-  if (0 == memcmp (&wm->clientIdentity,
-                   plugin->env->my_identity,
-                   sizeof(struct GNUNET_PeerIdentity)))
+  if (0 == memcmp (&wm->clientIdentity, plugin->env->my_identity,
+          sizeof(struct GNUNET_PeerIdentity)))
   {
     /* refuse connections from ourselves */
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -2278,14 +2277,10 @@
     return;
   }
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Received %s message from `%4s' %p\n",
-      "WELCOME",
+  LOG(GNUNET_ERROR_TYPE_DEBUG, "Received %s message from `%4s' %p\n", 
"WELCOME",
       GNUNET_i2s (&wm->clientIdentity), client);
   GNUNET_STATISTICS_update (plugin->env->stats,
-                            gettext_noop ("# TCP WELCOME messages received"),
-                            1,
-                            GNUNET_NO);
+      gettext_noop ("# TCP WELCOME messages received"), 1, GNUNET_NO);
   session = lookup_session_by_client (plugin, client);
   if (NULL != session)
   {
@@ -2293,9 +2288,8 @@
     {
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "Found existing session %p for peer `%s'\n",
-           session,
-           GNUNET_a2s (vaddr, alen));
-      GNUNET_free (vaddr);
+           session, GNUNET_a2s (vaddr, alen));
+      GNUNET_free(vaddr);
     }
   }
   else
@@ -2343,27 +2337,23 @@
       session->ats_address_network_type = plugin->env->get_address_type 
(plugin->env->cls, vaddr, alen);
       ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
       ats.value = htonl (session->ats_address_network_type);
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Creating new%s session %p for peer `%s' client %p \n",
-           GNUNET_HELLO_address_check_option (session->address,
-                                              
GNUNET_HELLO_ADDRESS_INFO_INBOUND)
-           ? " inbound" : "",
-           session,
-           tcp_plugin_address_to_string (NULL,
-                                         (void *) session->address->address,
-                                         session->address->address_length),
-           client);
-      GNUNET_free (vaddr);
-      GNUNET_SERVER_client_set_user_context (session->client, session);
+      LOG(GNUNET_ERROR_TYPE_DEBUG,
+          "Creating new%s session %p for peer `%s' client %p \n",
+          GNUNET_HELLO_address_check_option (session->address,
+                                             GNUNET_HELLO_ADDRESS_INFO_INBOUND)
+          ? " inbound" : "",
+          session,
+          tcp_plugin_address_to_string(NULL, (void *) 
session->address->address,
+                                       session->address->address_length),
+          client);
+      GNUNET_free(vaddr);
+      GNUNET_SERVER_client_set_user_context(session->client, session);
       GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
                                          &session->target,
                                          session,
                                          
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
       /* Notify transport and ATS about new session */
-      plugin->env->session_start (plugin->env->cls,
-                                  session->address,
-                                  session,
-                                  &ats, 1);
+      plugin->env->session_start (NULL, session->address, session, &ats, 1);
       notify_session_monitor (plugin,
                               session,
                               GNUNET_TRANSPORT_SS_INIT);

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2015-01-25 21:07:24 UTC (rev 
34992)
+++ gnunet/src/transport/plugin_transport_udp.c 2015-01-25 21:08:22 UTC (rev 
34993)
@@ -1327,13 +1327,10 @@
   struct UDP_MessageWrapper *next;
   struct FindReceiveContext frc;
 
-  GNUNET_assert (GNUNET_YES != s->in_destroy);
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Session %p to peer `%s' address ended\n", s,
+  GNUNET_assert(GNUNET_YES != s->in_destroy);
+  LOG(GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' address ended\n", s,
       GNUNET_i2s (&s->target),
-      udp_address_to_string (NULL,
-                             s->address->address,
-                             s->address->address_length));
+      udp_address_to_string (NULL, s->address->address, 
s->address->address_length));
   /* stop timeout task */
   if (NULL != s->timeout_task)
   {
@@ -1408,10 +1405,10 @@
     }
   }
 
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
-                                                       &s->target,
-                                                       s));
+  GNUNET_assert(GNUNET_YES ==
+                GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
+                                                      &s->target,
+                                                      s));
   GNUNET_STATISTICS_set (plugin->env->stats,
                          "# UDP sessions active",
                          GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
@@ -2338,8 +2335,7 @@
   address = GNUNET_HELLO_address_allocate ( &msg->sender, PLUGIN_NAME,
                                             arg, args,
                                             GNUNET_HELLO_ADDRESS_INFO_INBOUND);
-  if ( (NULL == (s = udp_plugin_lookup_session (plugin, address))) &&
-       (GNUNET_YES != s->in_destroy) )
+  if (NULL == (s = udp_plugin_lookup_session (plugin, address)))
   {
     s = udp_plugin_create_session (plugin, address);
     plugin->env->session_start (NULL, address, s, NULL, 0);
@@ -2358,12 +2354,9 @@
   si.arg = arg;
   si.args = args;
   s->rc++;
-  GNUNET_SERVER_mst_receive (plugin->mst,
-                             &si,
-                             (const char *) &msg[1],
-                             ntohs (msg->header.size) - sizeof(struct 
UDPMessage),
-                             GNUNET_YES,
-                             GNUNET_NO);
+  GNUNET_SERVER_mst_receive (plugin->mst, &si, (const char *) &msg[1],
+      ntohs (msg->header.size) - sizeof(struct UDPMessage), GNUNET_YES,
+      GNUNET_NO);
   s->rc--;
   if ((0 == s->rc) && (GNUNET_YES == s->in_destroy))
     free_session (s);
@@ -3621,12 +3614,12 @@
     return NULL;
   }
   stop_broadcast (plugin);
-  if (plugin->select_task != NULL)
+  if (plugin->select_task != NULL )
   {
     GNUNET_SCHEDULER_cancel (plugin->select_task);
     plugin->select_task = NULL;
   }
-  if (plugin->select_task_v6 != NULL)
+  if (plugin->select_task_v6 != NULL )
   {
     GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
     plugin->select_task_v6 = NULL;

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2015-01-25 21:07:24 UTC 
(rev 34992)
+++ gnunet/src/transport/plugin_transport_wlan.c        2015-01-25 21:08:22 UTC 
(rev 34993)
@@ -1395,6 +1395,7 @@
   struct Plugin *plugin = cls;
   struct GNUNET_HELLO_Address *address;
   struct MacAndSession *mas = client;
+  struct MacAndSession xmas;
   struct GNUNET_ATS_Information ats;
   struct FragmentMessage *fm;
   struct GNUNET_PeerIdentity tmpsource;
@@ -1447,17 +1448,6 @@
                                              &mas->endpoint->wlan_addr,
                                              sizeof (mas->endpoint->wlan_addr),
                                              
GNUNET_HELLO_ADDRESS_INFO_INBOUND);
-    mas->session = lookup_session (mas->endpoint,
-                                   &tmpsource);
-    if (NULL == mas->session)
-    {
-      mas->session = create_session (mas->endpoint,
-                                     &tmpsource);
-      plugin->env->session_start (plugin->env->cls,
-                                  address,
-                                  mas->session,
-                                  &ats, 1);
-    }
     plugin->env->receive (plugin->env->cls,
                           address,
                           mas->session,
@@ -1567,34 +1557,34 @@
                                GNUNET_NO);
       break;
     }
-    mas->session = lookup_session (mas->endpoint,
-                                   &wlanheader->sender);
-    if (NULL == mas->session)
+    xmas.endpoint = mas->endpoint;
+    if (NULL == (xmas.session = lookup_session (mas->endpoint,
+                                                &wlanheader->sender)))
     {
-      mas->session = create_session (mas->endpoint,
+      xmas.session = create_session (mas->endpoint,
                                      &wlanheader->sender);
       address = GNUNET_HELLO_address_allocate (&wlanheader->sender,
                                                PLUGIN_NAME,
                                                &mas->endpoint->wlan_addr,
                                                sizeof (struct WlanAddress),
                                                GNUNET_HELLO_ADDRESS_INFO_NONE);
-      plugin->env->session_start (plugin->env->cls,
+      plugin->env->session_start (NULL,
                                   address,
-                                  mas->session,
+                                  xmas.session,
                                   NULL, 0);
       LOG (GNUNET_ERROR_TYPE_DEBUG,
-           "Notifying transport about peer `%s''s new session %p \n",
+          "Notifying transport about peer `%s''s new session %p \n",
            GNUNET_i2s (&wlanheader->sender),
-           mas->session);
+           xmas.session);
       GNUNET_HELLO_address_free (address);
     }
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Processing %u bytes of DATA from peer `%s'\n",
         (unsigned int) msize,
         GNUNET_i2s (&wlanheader->sender));
-    mas->session->timeout = GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+    xmas.session->timeout = GNUNET_TIME_relative_to_absolute 
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
     (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer,
-                                     mas,
+                                     &xmas,
                                      (const char *) &wlanheader[1],
                                      msize - sizeof (struct WlanHeader),
                                      GNUNET_YES,
@@ -2198,12 +2188,9 @@
                                  GNUNET_BANDWIDTH_value_init (100 * 1024 *
                                                               1024 / 8),
                                  100);
-  plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data,
-                                                              plugin);
-  plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create 
(&process_data,
-                                                                    plugin);
-  plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data,
-                                                               plugin);
+  plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, 
plugin);
+  plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create 
(&process_data, plugin);
+  plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, 
plugin);
   plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
                                                  plugin);
 

Modified: gnunet/src/transport/test_transport_api_reliability.c
===================================================================
--- gnunet/src/transport/test_transport_api_reliability.c       2015-01-25 
21:07:24 UTC (rev 34992)
+++ gnunet/src/transport/test_transport_api_reliability.c       2015-01-25 
21:08:22 UTC (rev 34993)
@@ -87,22 +87,22 @@
 /**
  * Context of peer 1
  */
-static struct PeerContext *p1;
+struct PeerContext *p1;
 
 /**
  * Configuration file of peer 1
  */
-static char *cfg_file_p1;
+char *cfg_file_p1;
 
 /**
  * Context of peer 2
  */
-static struct PeerContext *p2;
+struct PeerContext *p2;
 
 /**
  * Configuration file of peer 1
  */
-static char *cfg_file_p2;
+char *cfg_file_p2;
 
 /**
  * Timeout task
@@ -112,12 +112,12 @@
 /**
  * Transport transmit handle used
  */
-static struct GNUNET_TRANSPORT_TransmitHandle *th;
+struct GNUNET_TRANSPORT_TransmitHandle *th;
 
 /**
  * Transport testing handle
  */
-static struct GNUNET_TRANSPORT_TESTING_handle *tth;
+struct GNUNET_TRANSPORT_TESTING_handle *tth;
 
 /*
  * Total amount of bytes sent
@@ -145,9 +145,7 @@
 static int msg_recv;
 
 static int test_connected;
-
 static int test_sending;
-
 static int test_send_timeout;
 
 
@@ -169,11 +167,9 @@
 #define OKPP do { ok++; } while (0)
 #endif
 
-
 static int
 get_bit (const char *map, unsigned int bit);
 
-
 static void
 end ()
 {




reply via email to

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