diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-07-17 09:47:51 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-07-17 09:47:51 +0000 |
commit | 615d5aef87f985e4c489fac6c6d6232d35f8b0c2 (patch) | |
tree | 82eb29b40821ee0a5405737ac2d9f0428c6c2619 /src/ats/plugin_ats_mlp.c | |
parent | 6053799e5d05b8d5c6c664b66e48f367b3dd6578 (diff) | |
download | gnunet-615d5aef87f985e4c489fac6c6d6232d35f8b0c2.tar.gz gnunet-615d5aef87f985e4c489fac6c6d6232d35f8b0c2.zip |
do not use NBO internally
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index b911435df..4491de078 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -394,9 +394,11 @@ struct GAS_MLP_Handle | |||
394 | struct MLP_information | 394 | struct MLP_information |
395 | { | 395 | { |
396 | 396 | ||
397 | /* Bandwidth assigned */ | 397 | /* Bandwidth assigned outbound */ |
398 | struct GNUNET_BANDWIDTH_Value32NBO b_out; | 398 | uint32_t b_out; |
399 | struct GNUNET_BANDWIDTH_Value32NBO b_in; | 399 | |
400 | /* Bandwidth assigned inbound */ | ||
401 | uint32_t b_in; | ||
400 | 402 | ||
401 | /* Address selected */ | 403 | /* Address selected */ |
402 | int n; | 404 | int n; |
@@ -1465,10 +1467,10 @@ mlp_propagate_results (void *cls, | |||
1465 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n", | 1467 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : enabling address\n", |
1466 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1468 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1467 | address->active = GNUNET_YES; | 1469 | address->active = GNUNET_YES; |
1468 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); | 1470 | address->assigned_bw_in = mlp_bw_in; |
1469 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1471 | mlpi->b_in = mlp_bw_in; |
1470 | address->assigned_bw_out.value__ = htonl (mlp_bw_out); | 1472 | address->assigned_bw_out = mlp_bw_out; |
1471 | mlpi->b_out.value__ = htonl(mlp_bw_out); | 1473 | mlpi->b_out = mlp_bw_out; |
1472 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) | 1474 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) |
1473 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); | 1475 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); |
1474 | return GNUNET_OK; | 1476 | return GNUNET_OK; |
@@ -1476,15 +1478,15 @@ mlp_propagate_results (void *cls, | |||
1476 | else if (GNUNET_YES == address->active) | 1478 | else if (GNUNET_YES == address->active) |
1477 | { | 1479 | { |
1478 | /* Address was used before, check for bandwidth change */ | 1480 | /* Address was used before, check for bandwidth change */ |
1479 | if ((mlp_bw_out != ntohl(address->assigned_bw_out.value__)) || | 1481 | if ((mlp_bw_out != address->assigned_bw_out) || |
1480 | (mlp_bw_in != ntohl(address->assigned_bw_in.value__))) | 1482 | (mlp_bw_in != address->assigned_bw_in)) |
1481 | { | 1483 | { |
1482 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : bandwidth changed\n", | 1484 | LOG (GNUNET_ERROR_TYPE_DEBUG, "%s %.2f : bandwidth changed\n", |
1483 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1485 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1484 | address->assigned_bw_in.value__ = htonl (mlp_bw_in); | 1486 | address->assigned_bw_in = mlp_bw_in; |
1485 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1487 | mlpi->b_in = mlp_bw_in; |
1486 | address->assigned_bw_out.value__ = htonl (mlp_bw_out); | 1488 | address->assigned_bw_out = mlp_bw_out; |
1487 | mlpi->b_out.value__ = htonl(mlp_bw_out); | 1489 | mlpi->b_out = mlp_bw_out; |
1488 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) | 1490 | if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) |
1489 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); | 1491 | mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); |
1490 | return GNUNET_OK; | 1492 | return GNUNET_OK; |
@@ -1511,11 +1513,10 @@ mlp_propagate_results (void *cls, | |||
1511 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); | 1513 | (1 == mlp_use) ? "[x]": "[ ]", mlp_bw_out); |
1512 | address->active = GNUNET_NO; | 1514 | address->active = GNUNET_NO; |
1513 | /* Set bandwidth to 0 */ | 1515 | /* Set bandwidth to 0 */ |
1514 | address->assigned_bw_in = BANDWIDTH_ZERO; | 1516 | address->assigned_bw_in = 0; |
1515 | mlpi->b_in.value__ = htonl(mlp_bw_in); | 1517 | mlpi->b_in = 0; |
1516 | address->assigned_bw_out = BANDWIDTH_ZERO; | 1518 | address->assigned_bw_out = 0; |
1517 | mlpi->b_out.value__ = htonl(mlp_bw_out); | 1519 | mlpi->b_out = 0; |
1518 | //mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); | ||
1519 | return GNUNET_OK; | 1520 | return GNUNET_OK; |
1520 | } | 1521 | } |
1521 | else | 1522 | else |
@@ -2338,8 +2339,8 @@ GAS_mlp_address_delete (void *solver, | |||
2338 | } | 2339 | } |
2339 | was_active = address->active; | 2340 | was_active = address->active; |
2340 | address->active = GNUNET_NO; | 2341 | address->active = GNUNET_NO; |
2341 | address->assigned_bw_in = BANDWIDTH_ZERO; | 2342 | address->assigned_bw_in = 0; |
2342 | address->assigned_bw_out = BANDWIDTH_ZERO; | 2343 | address->assigned_bw_out = 0; |
2343 | 2344 | ||
2344 | /* Is this peer included in the problem? */ | 2345 | /* Is this peer included in the problem? */ |
2345 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, | 2346 | if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers, |
@@ -2950,8 +2951,8 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2950 | 2951 | ||
2951 | if (GNUNET_NO == found) | 2952 | if (GNUNET_NO == found) |
2952 | { | 2953 | { |
2953 | mlp->pv.quota_in[c] = ntohl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 2954 | mlp->pv.quota_in[c] = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); |
2954 | mlp->pv.quota_out[c] = ntohl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 2955 | mlp->pv.quota_out[c] = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); |
2955 | LOG (GNUNET_ERROR_TYPE_INFO, _("Using default quota configuration for network `%s' (in/out) %llu/%llu\n"), | 2956 | LOG (GNUNET_ERROR_TYPE_INFO, _("Using default quota configuration for network `%s' (in/out) %llu/%llu\n"), |
2956 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2957 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), |
2957 | mlp->pv.quota_in[c], | 2958 | mlp->pv.quota_in[c], |