gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33655 - gnunet/src/ats
Date: Thu, 12 Jun 2014 17:21:12 +0200

Author: grothoff
Date: 2014-06-12 17:21:12 +0200 (Thu, 12 Jun 2014)
New Revision: 33655

Modified:
   gnunet/src/ats/plugin_ats_mlp.c
Log:
-fix warnings

Modified: gnunet/src/ats/plugin_ats_mlp.c
===================================================================
--- gnunet/src/ats/plugin_ats_mlp.c     2014-06-12 15:18:35 UTC (rev 33654)
+++ gnunet/src/ats/plugin_ats_mlp.c     2014-06-12 15:21:12 UTC (rev 33655)
@@ -1528,7 +1528,7 @@
 }
 
 
-static void 
+static void
 notify (struct GAS_MLP_Handle *mlp,
        enum GAS_Solver_Operation op,
        enum GAS_Solver_Status stat,
@@ -1539,7 +1539,7 @@
 }
 
 
-static void 
+static void
 mlp_branch_and_cut_cb (glp_tree *tree, void *info)
 {
   struct GAS_MLP_Handle *mlp = info;
@@ -2180,77 +2180,11 @@
 
 
 /**
- * Deletes a single address in the MLP problem
- *
- * The MLP problem has to be recreated and the problem has to be resolved
- *
- * @param solver the MLP Handle
- * @param address the address to delete
- * @param session_only delete only session not whole address
- */
-static void
-GAS_mlp_address_delete (void *solver,
-                       struct ATS_Address *address,
-                       int session_only)
-{
-  struct ATS_Peer *p;
-  struct GAS_MLP_Handle *mlp = solver;
-  struct MLP_information *mlpi;
-  int was_active;
-
-  GNUNET_assert (NULL != solver);
-  GNUNET_assert (NULL != address);
-
-  mlpi = address->solver_information;
-  if ((GNUNET_NO == session_only) && (NULL != mlpi))
-  {
-    /* Remove full address */
-    GNUNET_free (mlpi);
-    address->solver_information = NULL;
-  }
-  was_active = address->active;
-  address->active = GNUNET_NO;
-  address->assigned_bw_in = BANDWIDTH_ZERO;
-  address->assigned_bw_out = BANDWIDTH_ZERO;
-
-  /* Is this peer included in the problem? */
-  if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
-                                                     &address->peer)))
-  {
-    LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' without address 
request \n",
-        (session_only == GNUNET_YES) ? "session" : "address",
-        GNUNET_i2s(&address->peer));
-    return;
-  }
-  LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' with address request 
\n",
-      (session_only == GNUNET_YES) ? "session" : "address",
-      GNUNET_i2s(&address->peer));
-
-  /* Problem size changed: new address for peer with pending request */
-  mlp->stat_mlp_prob_changed = GNUNET_YES;
-  if (GNUNET_YES == mlp->opt_mlp_auto_solve)
-  {
-    GAS_mlp_solve_problem (solver);
-  }
-  if (GNUNET_YES == was_active)
-  {
-    if (NULL == GAS_mlp_get_preferred_address (solver, &address->peer))
-    {
-      /* No alternative address, disconnecting peer */
-      mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
-    }
-  }
-
-  return;
-}
-
-
-/**
  * Find the active address in the set of addresses of a peer
  * @param cls destination
  * @param key peer id
  * @param value address
- * @return GNUNET_OK
+ * @return #GNUNET_OK
  */
 static int
 mlp_get_preferred_address_it (void *cls,
@@ -2282,13 +2216,14 @@
     (*aa)->assigned_bw_out = mlpi->b_out;
     return GNUNET_NO;
   }
-  counter ++;
+  counter++;
   return GNUNET_YES;
 }
 
 
 static double
-get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct 
GNUNET_PeerIdentity *peer)
+get_peer_pref_value (struct GAS_MLP_Handle *mlp,
+                     const struct GNUNET_PeerIdentity *peer)
 {
   double res;
   const double *preferences = NULL;
@@ -2309,8 +2244,9 @@
   res /= (GNUNET_ATS_PreferenceCount -1);
   res += 1.0;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer preference for peer  `%s' == %.2f\n",
-      GNUNET_i2s(peer), res);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Peer preference for peer  `%s' == %.2f\n",
+       GNUNET_i2s(peer), res);
 
   return res;
 }
@@ -2366,12 +2302,78 @@
   /* Get prefered address */
   res = NULL;
   GNUNET_CONTAINER_multipeermap_get_multiple (mlp->addresses, peer,
-                                              mlp_get_preferred_address_it, 
&res);
+                                              &mlp_get_preferred_address_it, 
&res);
   return res;
 }
 
 
 /**
+ * Deletes a single address in the MLP problem
+ *
+ * The MLP problem has to be recreated and the problem has to be resolved
+ *
+ * @param solver the MLP Handle
+ * @param address the address to delete
+ * @param session_only delete only session not whole address
+ */
+static void
+GAS_mlp_address_delete (void *solver,
+                       struct ATS_Address *address,
+                       int session_only)
+{
+  struct ATS_Peer *p;
+  struct GAS_MLP_Handle *mlp = solver;
+  struct MLP_information *mlpi;
+  int was_active;
+
+  GNUNET_assert (NULL != solver);
+  GNUNET_assert (NULL != address);
+
+  mlpi = address->solver_information;
+  if ((GNUNET_NO == session_only) && (NULL != mlpi))
+  {
+    /* Remove full address */
+    GNUNET_free (mlpi);
+    address->solver_information = NULL;
+  }
+  was_active = address->active;
+  address->active = GNUNET_NO;
+  address->assigned_bw_in = BANDWIDTH_ZERO;
+  address->assigned_bw_out = BANDWIDTH_ZERO;
+
+  /* Is this peer included in the problem? */
+  if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
+                                                     &address->peer)))
+  {
+    LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' without address 
request \n",
+        (session_only == GNUNET_YES) ? "session" : "address",
+        GNUNET_i2s(&address->peer));
+    return;
+  }
+  LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' with address request 
\n",
+      (session_only == GNUNET_YES) ? "session" : "address",
+      GNUNET_i2s(&address->peer));
+
+  /* Problem size changed: new address for peer with pending request */
+  mlp->stat_mlp_prob_changed = GNUNET_YES;
+  if (GNUNET_YES == mlp->opt_mlp_auto_solve)
+  {
+    GAS_mlp_solve_problem (solver);
+  }
+  if (GNUNET_YES == was_active)
+  {
+    if (NULL == GAS_mlp_get_preferred_address (solver, &address->peer))
+    {
+      /* No alternative address, disconnecting peer */
+      mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
+    }
+  }
+
+  return;
+}
+
+
+/**
  * Start a bulk operation
  *
  * @param solver the solver
@@ -2379,11 +2381,11 @@
 static void
 GAS_mlp_bulk_start (void *solver)
 {
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Locking solver for bulk operation ...\n");
-  struct GAS_MLP_Handle *s = (struct GAS_MLP_Handle *) solver;
+  struct GAS_MLP_Handle *s = solver;
 
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Locking solver for bulk operation ...\n");
   GNUNET_assert (NULL != solver);
-
   s->stat_bulk_lock ++;
 }
 
@@ -2391,9 +2393,10 @@
 static void
 GAS_mlp_bulk_stop (void *solver)
 {
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Unlocking solver from bulk operation ...\n");
+  struct GAS_MLP_Handle *s = solver;
 
-  struct GAS_MLP_Handle *s = (struct GAS_MLP_Handle *) solver;
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Unlocking solver from bulk operation ...\n");
   GNUNET_assert (NULL != solver);
 
   if (s->stat_bulk_lock < 1)
@@ -2538,7 +2541,7 @@
   struct GAS_MLP_Handle *mlp = cls;
   GNUNET_assert (mlp != NULL);
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, 
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Shutting down mlp solver\n");
   mlp_delete_problem (mlp);
 




reply via email to

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