*
* @param n neighbour entry to change qutoa for
* @param quota new quota
+ * @return #GNUNET_YES if @a n is still valid, @GNUNET_NO if
+ * @a n was freed
*/
-static void
+static int
set_incoming_quota (struct NeighbourMapEntry *n,
struct GNUNET_BANDWIDTH_Value32NBO quota)
{
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_NO,
NULL, NULL);
- return;
+ return GNUNET_YES;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Disconnecting peer `%s' due to SET_QUOTA\n",
gettext_noop ("# disconnects due to quota of 0"),
1, GNUNET_NO);
disconnect_neighbour (n);
+ return GNUNET_NO;
}
if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
{
n->primary_address.bandwidth_in = bandwidth_in;
- set_incoming_quota (n,
- bandwidth_in);
+ if (GNUNET_YES !=
+ set_incoming_quota (n,
+ bandwidth_in))
+ return;
}
if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
{
/* subsystems about address use */
GST_validation_set_address_use (n->primary_address.address,
GNUNET_YES);
- set_incoming_quota (n,
- bandwidth_in);
+ if (GNUNET_YES !=
+ set_incoming_quota (n,
+ bandwidth_in))
+ return;
send_outbound_quota_to_clients (n);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Neighbour `%s' switched to address `%s'\n",
if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
{
n->primary_address.bandwidth_in = bandwidth_in;
- set_incoming_quota (n,
- bandwidth_in);
+ if (GNUNET_YES !=
+ set_incoming_quota (n,
+ bandwidth_in))
+ return GNUNET_NO;
}
if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
{