aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 34ec1eaeb..e2af74030 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1209,6 +1209,38 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
1209 GNUNET_i2s (peer)); 1209 GNUNET_i2s (peer));
1210#endif 1210#endif
1211 1211
1212 // do not switch addresses just update quotas
1213 if (n != NULL)
1214 {
1215 if ((is_connected(n)) && (address_len == n->addrlen))
1216 {
1217 if ((0 == memcmp (address, n->addr, address_len)) &&
1218 (n->session == session))
1219 {
1220 struct QuotaSetMessage q_msg;
1221
1222#if DEBUG_TRANSPORT
1223 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1224 "Sending outbound quota of %u Bps and inbound quota of % Bps for peer `%s' to all clients\n",
1225 ntohl (n->bandwidth_out.value__),
1226 ntohl (n->bandwidth_in.value__),
1227 GNUNET_i2s (peer));
1228#endif
1229
1230 n->bandwidth_in = bandwidth_in;
1231 n->bandwidth_out = bandwidth_out;
1232 GST_neighbours_set_incoming_quota(&n->id, n->bandwidth_in);
1233
1234 q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
1235 q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
1236 q_msg.quota = n->bandwidth_out;
1237 q_msg.peer = (*peer);
1238 GST_clients_broadcast (&q_msg.header, GNUNET_NO);
1239 return GNUNET_NO;
1240 }
1241 }
1242 }
1243
1212 GNUNET_free_non_null (n->addr); 1244 GNUNET_free_non_null (n->addr);
1213 n->addr = GNUNET_malloc (address_len); 1245 n->addr = GNUNET_malloc (address_len);
1214 memcpy (n->addr, address, address_len); 1246 memcpy (n->addr, address, address_len);