gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r27727 - gnunet/src/ats
Date: Tue, 2 Jul 2013 17:08:37 +0200

Author: wachs
Date: 2013-07-02 17:08:37 +0200 (Tue, 02 Jul 2013)
New Revision: 27727

Modified:
   gnunet/src/ats/gnunet-service-ats-solver_mlp.c
   gnunet/src/ats/gnunet-service-ats-solver_mlp.h
   gnunet/src/ats/gnunet-service-ats-solver_proportional.c
Log:
finished buld support


Modified: gnunet/src/ats/gnunet-service-ats-solver_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_mlp.c      2013-07-02 14:54:42 UTC 
(rev 27726)
+++ gnunet/src/ats/gnunet-service-ats-solver_mlp.c      2013-07-02 15:08:37 UTC 
(rev 27727)
@@ -953,6 +953,12 @@
        struct GNUNET_TIME_Relative duration_mlp;
        GNUNET_assert (NULL != solver);
 
+       if (GNUNET_YES == mlp->bulk_lock)
+       {
+               mlp->bulk_request ++;
+               return GNUNET_NO;
+       }
+
        if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == 
mlp->mlp_prob_updated))
        {
                LOG (GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n");
@@ -1356,6 +1362,7 @@
 
        /* Problem size changed: new address for peer with pending request */
        mlp->mlp_prob_updated = GNUNET_YES;
+
        if (GNUNET_YES == mlp->mlp_auto_solve)
                GAS_mlp_solve_problem (solver, addresses);
   return;
@@ -1538,10 +1545,10 @@
   }
   s->bulk_lock --;
 
-  if (0 < s->bulk_changes)
+  if (0 < s->bulk_request)
   {
        GAS_mlp_solve_problem (solver, s->addresses);
-       s->bulk_changes = 0;
+       s->bulk_request= 0;
   }
 }
 
@@ -1613,12 +1620,6 @@
 
        /* Problem size changed: new address for peer with pending request */
        mlp->mlp_prob_updated = GNUNET_YES;
-       if (GNUNET_YES == mlp->bulk_lock)
-       {
-               mlp->bulk_changes++;
-               return;
-       }
-
        if (GNUNET_YES == mlp->mlp_auto_solve)
                GAS_mlp_solve_problem (solver, addresses);
   return;
@@ -1908,6 +1909,8 @@
   mlp->mlp_prob_updated = GNUNET_NO;
   mlp->mlp_auto_solve = GNUNET_YES;
   mlp->peers = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
+  mlp->bulk_request = 0;
+  mlp->bulk_lock = 0;
 
   /* Setup GLPK */
   /* Redirect GLPK output to GNUnet logging */

Modified: gnunet/src/ats/gnunet-service-ats-solver_mlp.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_mlp.h      2013-07-02 14:54:42 UTC 
(rev 27726)
+++ gnunet/src/ats/gnunet-service-ats-solver_mlp.h      2013-07-02 15:08:37 UTC 
(rev 27727)
@@ -254,7 +254,7 @@
   /**
    * Number of changes while solver was locked
    */
-  int bulk_changes;
+  int bulk_request;
 
   /**
    * GLPK LP control parameter

Modified: gnunet/src/ats/gnunet-service-ats-solver_proportional.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_proportional.c     2013-07-02 
14:54:42 UTC (rev 27726)
+++ gnunet/src/ats/gnunet-service-ats-solver_proportional.c     2013-07-02 
15:08:37 UTC (rev 27727)
@@ -251,7 +251,7 @@
   /**
    * Number of changes while solver was locked
    */
-  int bulk_changes;
+  int bulk_requests;
 
 
   /**
@@ -416,6 +416,13 @@
   unsigned long long assigned_quota_out = 0;
   struct AddressWrapper *cur;
 
+
+       if (GNUNET_YES == s->bulk_lock)
+       {
+               s->bulk_requests++;
+               return;
+       }
+
   LOG (GNUNET_ERROR_TYPE_DEBUG,
               "Recalculate quota for network type `%s' for %u addresses 
(in/out): %llu/%llu \n",
               net->desc, net->active_addresses, net->total_quota_in, 
net->total_quota_in);
@@ -654,6 +661,7 @@
 distribute_bandwidth_in_all_networks (struct GAS_PROPORTIONAL_Handle *s)
 {
        int i;
+
        for (i = 0; i < s->networks; i++)
                distribute_bandwidth_in_network (s, &s->network_entries[i], 
NULL);
 
@@ -865,10 +873,7 @@
   GNUNET_assert (NULL != solver);
   GNUNET_assert (NULL != peer);
 
-  if (GNUNET_NO == s->bulk_lock)
-       distribute_bandwidth_in_all_networks (s);
-  else
-       s->bulk_changes ++;
+       distribute_bandwidth_in_all_networks (s);
 }
 
 /**
@@ -934,10 +939,7 @@
       s->bw_changed (s->bw_changed_cls, prev); /* notify about bw change, 
REQUIRED? */
       if (GNUNET_SYSERR == addresse_decrement (s, net_prev, GNUNET_NO, 
GNUNET_YES))
         GNUNET_break (0);
-      if (GNUNET_NO == s->bulk_lock)
-       distribute_bandwidth_in_network (s, net_prev, NULL);
-      else
-       s->bulk_changes ++;
+       distribute_bandwidth_in_network (s, net_prev, NULL);
   }
 
   if (GNUNET_NO == (is_bandwidth_available_in_network 
(cur->solver_information)))
@@ -948,11 +950,7 @@
 
   cur->active = GNUNET_YES;
   addresse_increment(s, net_cur, GNUNET_NO, GNUNET_YES);
-  if (GNUNET_NO == s->bulk_lock)
-       distribute_bandwidth_in_network (s, net_cur, cur);
-  else
-       s->bulk_changes ++;
-
+  distribute_bandwidth_in_network (s, net_cur, cur);
   return cur;
 }
 
@@ -1037,10 +1035,7 @@
       address->active = GNUNET_NO;
       if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES))
         GNUNET_break (0);
-      if (GNUNET_NO == s->bulk_lock)
-       distribute_bandwidth_in_network (s, net, NULL);
-      else
-       s->bulk_changes ++;
+      distribute_bandwidth_in_network (s, net, NULL);
   }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "After deleting address now total %u and 
active %u addresses in network `%s'\n",
       net->total_addresses,
@@ -1082,11 +1077,11 @@
        return;
   }
   s->bulk_lock --;
-  if ((0 == s->bulk_lock) && (s->bulk_changes))
+  if ((0 == s->bulk_lock) && (0 < s->bulk_requests))
   {
        LOG (GNUNET_ERROR_TYPE_ERROR, "No lock pending, recalculating\n");
        distribute_bandwidth_in_all_networks (s);
-       s->bulk_changes = 0;
+       s->bulk_requests = 0;
   }
 }
 
@@ -1194,10 +1189,7 @@
               /* Suggest updated address */
               address->active = GNUNET_YES;
               addresse_increment (s, new_net, GNUNET_NO, GNUNET_YES);
-              if (GNUNET_NO == s->bulk_lock)
-               distribute_bandwidth_in_network (solver, new_net, NULL);
-              else
-               s->bulk_changes ++;
+              distribute_bandwidth_in_network (solver, new_net, NULL);
           }
           else
           {




reply via email to

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