[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29621 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29621 - gnunet/src/ats |
Date: |
Thu, 26 Sep 2013 16:49:30 +0200 |
Author: wachs
Date: 2013-09-26 16:49:30 +0200 (Thu, 26 Sep 2013)
New Revision: 29621
Modified:
gnunet/src/ats/gnunet-service-ats-solver_mlp.c
gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
Log:
minor fixes
Modified: gnunet/src/ats/gnunet-service-ats-solver_mlp.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats-solver_mlp.c 2013-09-26 14:41:37 UTC
(rev 29620)
+++ gnunet/src/ats/gnunet-service-ats-solver_mlp.c 2013-09-26 14:49:30 UTC
(rev 29621)
@@ -991,13 +991,16 @@
if (GNUNET_NO == address->active)
{
/* Address was not used before, enabling address */
- LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n", (1 ==
mlp_use) ? "[x]": "[ ]", mlp_bw_out);
- address->active = GNUNET_YES;
- address->assigned_bw_in.value__ = htonl (mlp_bw_in);
- mlpi->b_in.value__ = htonl(mlp_bw_in);
- address->assigned_bw_out.value__ = htonl (mlp_bw_out);
- mlpi->b_out.value__ = htonl(mlp_bw_out);
- mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n",
+ (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out);
+ address->active = GNUNET_YES;
+ address->assigned_bw_in.value__ = htonl (mlp_bw_in);
+ mlpi->b_in.value__ = htonl(mlp_bw_in);
+ address->assigned_bw_out.value__ = htonl (mlp_bw_out);
+ mlpi->b_out.value__ = htonl(mlp_bw_out);
+
+ mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
+ return GNUNET_OK;
}
else if (GNUNET_YES == address->active)
{
@@ -1011,11 +1014,13 @@
mlpi->b_in.value__ = htonl(mlp_bw_in);
address->assigned_bw_out.value__ = htonl (mlp_bw_out);
mlpi->b_out.value__ = htonl(mlp_bw_out);
+
mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
+ return GNUNET_OK;
}
}
else
- GNUNET_break (0);
+ GNUNET_break (0);
}
else if (GLP_NO == mlp_use)
{
@@ -1026,6 +1031,7 @@
/* Address was not used before, nothing to do */
LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : no change\n",
(1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out);
+ return GNUNET_OK;
}
else if (GNUNET_YES == address->active)
{
@@ -1039,6 +1045,7 @@
address->assigned_bw_out = BANDWIDTH_ZERO;
mlpi->b_out.value__ = htonl(mlp_bw_out);
//mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
+ return GNUNET_OK;
}
else
GNUNET_break (0);
Modified: gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
===================================================================
--- gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
2013-09-26 14:41:37 UTC (rev 29620)
+++ gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
2013-09-26 14:49:30 UTC (rev 29621)
@@ -25,7 +25,7 @@
*/
/**
* @file ats/test_ats_solver_add_address.c
- * @brief solver test: add address, request address and wait for suggest
+ * @brief solver test: add 2 addresses, request address, delete, expect
alternative
* @author Christian Grothoff
* @author Matthias Wachs
*/
@@ -108,9 +108,9 @@
int second_address_suggested = GNUNET_YES;
-static const struct GNUNET_HELLO_Address *first_suggestion = NULL;
+static struct GNUNET_HELLO_Address *first_suggestion = NULL;
-static const struct GNUNET_HELLO_Address *second_suggestion = NULL;
+static struct GNUNET_HELLO_Address *second_suggestion = NULL;
static int
@@ -140,7 +140,8 @@
}
free_test_address (&test_addr);
-
+ GNUNET_free_non_null (first_suggestion);
+ GNUNET_free_non_null (second_suggestion);
ret = 0;
}
@@ -185,14 +186,15 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received 1st sugggestion for peer
`%s' : `%s'\n",
GNUNET_i2s (&address->peer), (char *) address->address);
- first_suggestion = address;
+ first_suggestion = GNUNET_HELLO_address_copy (address);
first_address_suggested = GNUNET_YES;
+
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Deleting 1st address for peer `%s'
: `%s'\n",
GNUNET_i2s (&address->peer), (char *) address->address);
-
GNUNET_ATS_address_destroyed (sched_ats, address, session);
first_address_deleted = GNUNET_YES;
+
return;
}
}
@@ -219,18 +221,19 @@
return;
}
- if (first_suggestion->address_length == address->address_length)
+ if (0 == memcmp (address->address, first_suggestion->address,
+ (first_suggestion->address_length < address->address_length) ?
first_suggestion->address_length : address->address_length))
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Deleted address for peer `%s' was
suggested after deletion: `%s'\n",
- GNUNET_i2s (&address->peer), (char *) address->address);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Deleted 1st address for peer `%s'
was suggested after deletion: `%s' `%s'\n",
+ GNUNET_i2s (&address->peer), (char *) address->address,
first_suggestion->address);
GNUNET_break (0);
- //GNUNET_SCHEDULER_add_now (&end_badly, NULL);
+ GNUNET_SCHEDULER_add_now (&end_badly, NULL);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received 2nd sugggestion for peer
`%s' : `%s'\n",
GNUNET_i2s (&address->peer), (char *) address->address);
- second_suggestion = address;
+ second_suggestion = GNUNET_HELLO_address_copy (address);
second_address_suggested = GNUNET_YES;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Deleting 2nd address for peer `%s'
: `%s'\n",
@@ -239,8 +242,9 @@
second_address_deleted = GNUNET_YES;
return;
}
+
}
- if (GNUNET_YES ==second_address_deleted)
+ if (GNUNET_YES == second_address_deleted)
{
/* Expecting disconnect */
if ((ntohl(bandwidth_in.value__) == 0) &&
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29621 - gnunet/src/ats,
gnunet <=