aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index ac72a667c..b6db9ea8b 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1133,8 +1133,10 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
1133 * 1133 *
1134 * @param n neighbour entry to change qutoa for 1134 * @param n neighbour entry to change qutoa for
1135 * @param quota new quota 1135 * @param quota new quota
1136 * @return #GNUNET_YES if @a n is still valid, @GNUNET_NO if
1137 * @a n was freed
1136 */ 1138 */
1137static void 1139static int
1138set_incoming_quota (struct NeighbourMapEntry *n, 1140set_incoming_quota (struct NeighbourMapEntry *n,
1139 struct GNUNET_BANDWIDTH_Value32NBO quota) 1141 struct GNUNET_BANDWIDTH_Value32NBO quota)
1140{ 1142{
@@ -1158,7 +1160,7 @@ set_incoming_quota (struct NeighbourMapEntry *n,
1158 GNUNET_TIME_UNIT_FOREVER_REL, 1160 GNUNET_TIME_UNIT_FOREVER_REL,
1159 GNUNET_NO, 1161 GNUNET_NO,
1160 NULL, NULL); 1162 NULL, NULL);
1161 return; 1163 return GNUNET_YES;
1162 } 1164 }
1163 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1165 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1164 "Disconnecting peer `%s' due to SET_QUOTA\n", 1166 "Disconnecting peer `%s' due to SET_QUOTA\n",
@@ -1168,6 +1170,7 @@ set_incoming_quota (struct NeighbourMapEntry *n,
1168 gettext_noop ("# disconnects due to quota of 0"), 1170 gettext_noop ("# disconnects due to quota of 0"),
1169 1, GNUNET_NO); 1171 1, GNUNET_NO);
1170 disconnect_neighbour (n); 1172 disconnect_neighbour (n);
1173 return GNUNET_NO;
1171} 1174}
1172 1175
1173 1176
@@ -1196,8 +1199,10 @@ set_primary_address (struct NeighbourMapEntry *n,
1196 if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) 1199 if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
1197 { 1200 {
1198 n->primary_address.bandwidth_in = bandwidth_in; 1201 n->primary_address.bandwidth_in = bandwidth_in;
1199 set_incoming_quota (n, 1202 if (GNUNET_YES !=
1200 bandwidth_in); 1203 set_incoming_quota (n,
1204 bandwidth_in))
1205 return;
1201 } 1206 }
1202 if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) 1207 if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
1203 { 1208 {
@@ -1237,8 +1242,10 @@ set_primary_address (struct NeighbourMapEntry *n,
1237 /* subsystems about address use */ 1242 /* subsystems about address use */
1238 GST_validation_set_address_use (n->primary_address.address, 1243 GST_validation_set_address_use (n->primary_address.address,
1239 GNUNET_YES); 1244 GNUNET_YES);
1240 set_incoming_quota (n, 1245 if (GNUNET_YES !=
1241 bandwidth_in); 1246 set_incoming_quota (n,
1247 bandwidth_in))
1248 return;
1242 send_outbound_quota_to_clients (n); 1249 send_outbound_quota_to_clients (n);
1243 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1250 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1244 "Neighbour `%s' switched to address `%s'\n", 1251 "Neighbour `%s' switched to address `%s'\n",
@@ -2393,8 +2400,10 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address,
2393 if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__) 2400 if (n->primary_address.bandwidth_in.value__ != bandwidth_in.value__)
2394 { 2401 {
2395 n->primary_address.bandwidth_in = bandwidth_in; 2402 n->primary_address.bandwidth_in = bandwidth_in;
2396 set_incoming_quota (n, 2403 if (GNUNET_YES !=
2397 bandwidth_in); 2404 set_incoming_quota (n,
2405 bandwidth_in))
2406 return GNUNET_NO;
2398 } 2407 }
2399 if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__) 2408 if (n->primary_address.bandwidth_out.value__ != bandwidth_out.value__)
2400 { 2409 {