gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26733 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r26733 - gnunet/src/ats
Date: Wed, 3 Apr 2013 13:12:10 +0200

Author: wachs
Date: 2013-04-03 13:12:10 +0200 (Wed, 03 Apr 2013)
New Revision: 26733

Modified:
   gnunet/src/ats/gnunet-service-ats_addresses.c
   gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c
Log:
fixed network switching


Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c       2013-04-03 10:56:21 UTC 
(rev 26732)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c       2013-04-03 11:12:10 UTC 
(rev 26733)
@@ -895,9 +895,6 @@
                 "ADDRESS UPDATE",
                 GNUNET_i2s (peer), aa);
 
-  /* Tell solver about update */
-  handle->s_update (handle->solver, handle->addresses, aa, session_id, 
aa->used, atsi, atsi_count);
-
   /* Update address */
   atsi_delta = NULL;
   if (GNUNET_YES == disassemble_ats_information (aa, atsi, atsi_count, 
&atsi_delta, &atsi_delta_count))
@@ -911,6 +908,8 @@
                                aa->assigned_bw_out,
                                aa->assigned_bw_in);
   }
+  /* Tell solver about update */
+  handle->s_update (handle->solver, handle->addresses, aa, session_id, 
aa->used, atsi_delta, atsi_delta_count);
   GNUNET_free_non_null (atsi_delta);
 }
 

Modified: gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c    2013-04-03 
10:56:21 UTC (rev 26732)
+++ gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c    2013-04-03 
11:12:10 UTC (rev 26733)
@@ -937,22 +937,22 @@
                               struct ATS_Address *address,
                               uint32_t session,
                               int in_use,
-                              const struct GNUNET_ATS_Information *atsi,
-                              uint32_t atsi_count)
+                              const struct GNUNET_ATS_Information *prev_ats,
+                              uint32_t prev_atsi_count)
 {
   struct ATS_Address *new;
   struct GAS_SIMPLISTIC_Handle *s = (struct GAS_SIMPLISTIC_Handle *) solver;
   int i;
-  uint32_t value;
-  uint32_t type;
+  uint32_t prev_value;
+  uint32_t prev_type;
   uint32_t addr_net;
   int save_active = GNUNET_NO;
   struct Network *new_net = NULL;
-  for (i = 0; i < atsi_count; i++)
+  for (i = 0; i < prev_atsi_count; i++)
   {
-    type = ntohl (atsi[i].type);
-    value = ntohl (atsi[i].value);
-    switch (type)
+    prev_type = ntohl (prev_ats[i].type);
+    prev_value = ntohl (prev_ats[i].value);
+    switch (prev_type)
     {
     case GNUNET_ATS_UTILIZATION_UP:
       //if (address->atsp_utilization_out.value__ != atsi[i].value)
@@ -989,24 +989,24 @@
        GNUNET_break (0);
        addr_net = GNUNET_ATS_NET_UNSPECIFIED;
       }
-      if (addr_net != value)
+      if (addr_net != prev_value)
       {
 
         LOG (GNUNET_ERROR_TYPE_DEBUG, "Network type changed, moving %s address 
from `%s' to `%s'\n",
             (GNUNET_YES == address->active) ? "active" : "inactive",
-            GNUNET_ATS_print_network_type(addr_net),
-            GNUNET_ATS_print_network_type(value));
+             GNUNET_ATS_print_network_type(prev_value),
+             GNUNET_ATS_print_network_type(addr_net));
 
         save_active = address->active;
         /* remove from old network */
         GAS_simplistic_address_delete (solver, addresses, address, GNUNET_NO);
 
         /* set new network type */
-        new_net = find_network (solver, value);
+        new_net = find_network (solver, addr_net);
         address->solver_information = new_net;
 
         /* Add to new network and update*/
-        GAS_simplistic_address_add (solver, addresses, address, value);
+        GAS_simplistic_address_add (solver, addresses, address, addr_net);
         if (GNUNET_YES == save_active)
         {
           /* check if bandwidth available in new network */
@@ -1043,7 +1043,7 @@
       break;
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  "Received unsupported ATS type %u\n", type);
+                  "Received unsupported ATS type %u\n", prev_type);
       GNUNET_break (0);
       break;
 




reply via email to

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