diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-13 08:10:35 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-09-13 08:10:35 +0000 |
commit | f85132b0f28334dd463a17a6a8baf7230274c66d (patch) | |
tree | 9aedb88fd49576466601647de7a2ced4ec3b4d86 /src | |
parent | b652bbe551ffb1851087ec7ca5a2149007078c9f (diff) | |
download | gnunet-f85132b0f28334dd463a17a6a8baf7230274c66d.tar.gz gnunet-f85132b0f28334dd463a17a6a8baf7230274c66d.zip |
active address was not set to inactive if session is deleted
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_mlp.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c index 81f826dde..6154acf7b 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.c +++ b/src/ats/gnunet-service-ats-solver_mlp.c | |||
@@ -975,7 +975,7 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value | |||
975 | if ((GLP_YES == mlp_use) && (GNUNET_NO == address->active)) | 975 | if ((GLP_YES == mlp_use) && (GNUNET_NO == address->active)) |
976 | { | 976 | { |
977 | /* Address switch: Activate address*/ | 977 | /* Address switch: Activate address*/ |
978 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n", (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 978 | LOG (GNUNET_ERROR_TYPE_INFO, "%s %.2f : enabling address\n", (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
979 | address->active = GNUNET_YES; | 979 | address->active = GNUNET_YES; |
980 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); | 980 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); |
981 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 981 | mlpi->b_in.value__ = htonl(mlp_bw_in); |
@@ -987,7 +987,7 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value | |||
987 | else if ((GLP_NO == mlp_use) && (GNUNET_YES == address->active)) | 987 | else if ((GLP_NO == mlp_use) && (GNUNET_YES == address->active)) |
988 | { | 988 | { |
989 | /* Address switch: Disable address*/ | 989 | /* Address switch: Disable address*/ |
990 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : disabling address\n", (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 990 | LOG (GNUNET_ERROR_TYPE_INFO, "%s %.2f : disabling address\n", (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
991 | address->active = GNUNET_NO; | 991 | address->active = GNUNET_NO; |
992 | /* Set bandwidth to 0 */ | 992 | /* Set bandwidth to 0 */ |
993 | address->assigned_bw_in.value__ = htonl (0); | 993 | address->assigned_bw_in.value__ = htonl (0); |
@@ -1001,7 +1001,7 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value | |||
1001 | (mlp_bw_in != ntohl(address->assigned_bw_in.value__))) | 1001 | (mlp_bw_in != ntohl(address->assigned_bw_in.value__))) |
1002 | { | 1002 | { |
1003 | /* Bandwidth changed */ | 1003 | /* Bandwidth changed */ |
1004 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : bandwidth changed\n", (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1004 | LOG (GNUNET_ERROR_TYPE_INFO, "%s %.2f : bandwidth changed\n", (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1005 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); | 1005 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); |
1006 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1006 | mlpi->b_in.value__ = htonl(mlp_bw_in); |
1007 | address->assigned_bw_out.value__ = htonl (mlp_bw_out); | 1007 | address->assigned_bw_out.value__ = htonl (mlp_bw_out); |
@@ -1420,8 +1420,9 @@ GAS_mlp_address_delete (void *solver, | |||
1420 | mlpi = address->solver_information; | 1420 | mlpi = address->solver_information; |
1421 | if ((GNUNET_NO == session_only) && (NULL != mlpi)) | 1421 | if ((GNUNET_NO == session_only) && (NULL != mlpi)) |
1422 | { | 1422 | { |
1423 | GNUNET_free (mlpi); | 1423 | /* Remove full address */ |
1424 | address->solver_information = NULL; | 1424 | GNUNET_free (mlpi); |
1425 | address->solver_information = NULL; | ||
1425 | } | 1426 | } |
1426 | 1427 | ||
1427 | /* Is this peer included in the problem? */ | 1428 | /* Is this peer included in the problem? */ |
@@ -1432,7 +1433,7 @@ GAS_mlp_address_delete (void *solver, | |||
1432 | GNUNET_i2s(&address->peer)); | 1433 | GNUNET_i2s(&address->peer)); |
1433 | return; | 1434 | return; |
1434 | } | 1435 | } |
1435 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Deleting %s for peer `%s' with address request \n", | 1436 | LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' with address request \n", |
1436 | (session_only == GNUNET_YES) ? "session" : "address", | 1437 | (session_only == GNUNET_YES) ? "session" : "address", |
1437 | GNUNET_i2s(&address->peer)); | 1438 | GNUNET_i2s(&address->peer)); |
1438 | 1439 | ||
@@ -1454,19 +1455,26 @@ GAS_mlp_address_delete (void *solver, | |||
1454 | static int | 1455 | static int |
1455 | mlp_get_preferred_address_it (void *cls, const struct GNUNET_HashCode * key, void *value) | 1456 | mlp_get_preferred_address_it (void *cls, const struct GNUNET_HashCode * key, void *value) |
1456 | { | 1457 | { |
1457 | 1458 | static int counter = 0; | |
1458 | struct ATS_Address **aa = (struct ATS_Address **) cls; | 1459 | struct ATS_Address **aa = (struct ATS_Address **) cls; |
1459 | struct ATS_Address *addr = value; | 1460 | struct ATS_Address *addr = value; |
1460 | struct MLP_information *mlpi = addr->solver_information; | 1461 | struct MLP_information *mlpi = addr->solver_information; |
1461 | if (mlpi == NULL) | 1462 | if (mlpi == NULL) |
1462 | return GNUNET_YES; | 1463 | return GNUNET_YES; |
1464 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1465 | "MLP [%u] Peer `%s' %s length %u session %u active %s mlp active %s\n", | ||
1466 | counter, GNUNET_i2s (&addr->peer), addr->plugin, addr->addr_len, addr->session_id, | ||
1467 | (GNUNET_YES == addr->active) ? "active" : "inactive", | ||
1468 | (GNUNET_YES == mlpi->n) ? "active" : "inactive"); | ||
1463 | if (GNUNET_YES == mlpi->n) | 1469 | if (GNUNET_YES == mlpi->n) |
1464 | { | 1470 | { |
1471 | |||
1465 | (*aa) = addr; | 1472 | (*aa) = addr; |
1466 | (*aa)->assigned_bw_in = mlpi->b_in; | 1473 | (*aa)->assigned_bw_in = mlpi->b_in; |
1467 | (*aa)->assigned_bw_out = mlpi->b_out; | 1474 | (*aa)->assigned_bw_out = mlpi->b_out; |
1468 | return GNUNET_NO; | 1475 | return GNUNET_NO; |
1469 | } | 1476 | } |
1477 | counter ++; | ||
1470 | return GNUNET_YES; | 1478 | return GNUNET_YES; |
1471 | } | 1479 | } |
1472 | 1480 | ||
@@ -1510,13 +1518,13 @@ GAS_mlp_get_preferred_address (void *solver, | |||
1510 | GNUNET_assert (NULL != solver); | 1518 | GNUNET_assert (NULL != solver); |
1511 | GNUNET_assert (NULL != peer); | 1519 | GNUNET_assert (NULL != peer); |
1512 | 1520 | ||
1513 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Getting preferred address for `%s'\n", | 1521 | LOG (GNUNET_ERROR_TYPE_INFO, "Getting preferred address for `%s'\n", |
1514 | GNUNET_i2s (peer)); | 1522 | GNUNET_i2s (peer)); |
1515 | 1523 | ||
1516 | /* Is this peer included in the problem? */ | 1524 | /* Is this peer included in the problem? */ |
1517 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) | 1525 | if (NULL == (p = GNUNET_CONTAINER_multihashmap_get (mlp->requested_peers, &peer->hashPubKey))) |
1518 | { | 1526 | { |
1519 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding peer `%s' to list of requested_peers with requests\n", | 1527 | LOG (GNUNET_ERROR_TYPE_INFO, "Adding peer `%s' to list of requested_peers with requests\n", |
1520 | GNUNET_i2s (peer)); | 1528 | GNUNET_i2s (peer)); |
1521 | 1529 | ||
1522 | p = GNUNET_malloc (sizeof (struct ATS_Peer)); | 1530 | p = GNUNET_malloc (sizeof (struct ATS_Peer)); |