GNUNET_assert(peer != NULL);
/* Add to list of pending requests */
- if (GNUNET_NO
- == GNUNET_CONTAINER_multihashmap_contains (s->requests,
+ if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (s->requests,
&peer->hashPubKey))
- GNUNET_CONTAINER_multihashmap_put (s->requests, &peer->hashPubKey, NULL,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ {
+ GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (s->requests, &peer->hashPubKey, NULL,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ }
/* Get address with: stick to current address, lower distance, lower latency */
fba_ctx.s = s;
prev->active = GNUNET_NO; /* No active any longer */
prev->assigned_bw_in = BANDWIDTH_ZERO; /* no bandwidth assigned */
prev->assigned_bw_out = BANDWIDTH_ZERO; /* no bandwidth assigned */
- if (GNUNET_SYSERR
- == addresse_decrement (s, net_prev, GNUNET_NO, GNUNET_YES))
+ if (GNUNET_SYSERR == addresse_decrement (s, net_prev, GNUNET_NO, GNUNET_YES))
GNUNET_break(0);
distribute_bandwidth_in_network (s, net_prev, NULL );
}
- if (GNUNET_NO
- == (is_bandwidth_available_in_network (fba_ctx.best->solver_information)))
+ if (GNUNET_NO == (is_bandwidth_available_in_network (fba_ctx.best->solver_information)))
{
GNUNET_break(0); /* This should never happen*/
return NULL ;
fba_ctx.best->active = GNUNET_YES;
addresse_increment (s, net_cur, GNUNET_NO, GNUNET_YES);
- distribute_bandwidth_in_network (s, net_cur, NULL );
+ distribute_bandwidth_in_network (s, net_cur, fba_ctx.best );
return fba_ctx.best;
}
struct GAS_PROPORTIONAL_Handle *s = solver;
struct Network *net;
struct AddressWrapper *aw;
+ const struct ATS_Address *new_address;
+
/* Remove an adress completely, we have to:
* - Remove from specific network
if (GNUNET_NO == session_only)
{
- LOG(GNUNET_ERROR_TYPE_DEBUG,
+ LOG(GNUNET_ERROR_TYPE_INFO,
"Deleting %s address %p for peer `%s' from network `%s' (total: %u/ active: %u)\n",
(GNUNET_NO == address->active) ? "inactive" : "active", address,
GNUNET_i2s (&address->peer), net->desc, net->total_addresses,
else
{
/* Remove session only: remove if active and update */
- LOG(GNUNET_ERROR_TYPE_DEBUG,
+ LOG(GNUNET_ERROR_TYPE_INFO,
"Deleting %s session %p for peer `%s' from network `%s' (total: %u/ active: %u)\n",
(GNUNET_NO == address->active) ? "inactive" : "active", address,
GNUNET_i2s (&address->peer), net->desc, net->total_addresses,
if (GNUNET_SYSERR == addresse_decrement (s, net, GNUNET_NO, GNUNET_YES))
GNUNET_break(0);
distribute_bandwidth_in_network (s, net, NULL );
+
+ if (NULL == (new_address = GAS_proportional_get_preferred_address (s, &address->peer)))
+ {
+ /* No alternative address found, disconnect peer */
+ s->bw_changed (s->bw_changed_cls, address);
+ }
+ else
+ {
+ s->bw_changed (s->bw_changed_cls, (struct ATS_Address *) new_address);
+ }
}
LOG(GNUNET_ERROR_TYPE_DEBUG,
"After deleting address now total %u and active %u addresses in network `%s'\n",
GNUNET_ATS_print_network_type (new_network));
/* Find new address to suggest since no bandwidth in network*/
- if (NULL
- == (new =
- (struct ATS_Address *) GAS_proportional_get_preferred_address (s,
- &address->peer)))
+ if (NULL == (new = (struct ATS_Address *) GAS_proportional_get_preferred_address (s, &address->peer)))
{
/* No alternative address found, disconnect peer */
s->bw_changed (s->bw_changed_cls, address);
struct GAS_PROPORTIONAL_Handle *s = solver;
struct Network *net = NULL;
struct AddressWrapper *aw = NULL;
+ const struct ATS_Address *new_address;
+
GNUNET_assert(NULL != s);
+
net = get_network (s, network);
if (NULL == net)
{
addresse_increment (s, net, GNUNET_YES, GNUNET_NO);
aw->addr->solver_information = net;
- if ((GNUNET_YES
- == GNUNET_CONTAINER_multihashmap_contains (s->requests,
- &address->peer.hashPubKey))
- && (NULL
- == get_active_address (s,
- (struct GNUNET_CONTAINER_MultiHashMap *) s->addresses,
- &address->peer)))
- GAS_proportional_get_preferred_address (s, &address->peer);
-
+ if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (s->requests, &address->peer.hashPubKey))
+ {
+ if (NULL == get_active_address (s, (struct GNUNET_CONTAINER_MultiHashMap *) s->addresses, &address->peer))
+ {
+ if (NULL != (new_address = GAS_proportional_get_preferred_address (s, &address->peer)))
+ s->bw_changed (s->bw_changed_cls, (struct ATS_Address *) address);
+ }
+ }
LOG(GNUNET_ERROR_TYPE_DEBUG,
"After adding address now total %u and active %u addresses in network `%s'\n",
net->total_addresses, net->active_addresses, net->desc);