summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-26 20:46:05 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-26 20:46:05 +0000
commita89ea716333ad5ad43757a946efc01cb5e95a0c0 (patch)
tree734846d7f0d45efae4db000c34c882e868ce5c81 /src/transport/gnunet-service-transport_neighbours.c
parent4f3250dfb068d6f378f4d504e06a9126d9dac99b (diff)
-indentation, logging, style issues
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index aab4f71e5..2614c8551 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -516,6 +516,41 @@ print_ack_state (enum GST_ACK_State s)
/**
+ * Send information about a new outbound quota to our clients.
+ * Note that the outbound quota is enforced client-side (i.e.
+ * in libgnunettransport).
+ *
+ * @param n affected peer
+ */
+static void
+send_outbound_quota_to_clients (struct NeighbourMapEntry *n)
+{
+ struct QuotaSetMessage q_msg;
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min;
+
+ if (! GNUNET_TRANSPORT_is_connected (n->state))
+ return;
+#if IGNORE_INBOUND_QUOTA
+ bandwidth_min = n->primary_address.bandwidth_out;
+#else
+ bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out,
+ n->neighbour_receive_quota);
+#endif
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
+ ntohl (bandwidth_min.value__),
+ GNUNET_i2s (&n->id));
+ q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
+ q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
+ q_msg.quota = bandwidth_min;
+ q_msg.peer = n->id;
+ GST_clients_broadcast (&q_msg.header,
+ GNUNET_NO);
+}
+
+
+/**
* Notify our clients that another peer connected to us.
*
* @param n the peer that connected
@@ -628,40 +663,6 @@ test_connected (struct NeighbourMapEntry *n)
/**
- * Send information about a new outbound quota to our clients.
- * Note that the outbound quota is enforced client-side (i.e.
- * in libgnunettransport).
- *
- * @param n affected peer
- */
-static void
-send_outbound_quota_to_clients (struct NeighbourMapEntry *n)
-{
- struct QuotaSetMessage q_msg;
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_min;
-
- if (! GNUNET_TRANSPORT_is_connected (n->state))
- return;
-#if IGNORE_INBOUND_QUOTA
- bandwidth_min = n->primary_address.bandwidth_out;
-#else
- bandwidth_min = GNUNET_BANDWIDTH_value_min (n->primary_address.bandwidth_out,
- n->neighbour_receive_quota);
-#endif
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
- ntohl (bandwidth_min.value__),
- GNUNET_i2s (&n->id));
- q_msg.header.size = htons (sizeof (struct QuotaSetMessage));
- q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
- q_msg.quota = bandwidth_min;
- q_msg.peer = n->id;
- GST_clients_broadcast (&q_msg.header, GNUNET_NO);
-}
-
-
-/**
* We don't need a given neighbour address any more.
* Release its resources and give appropriate notifications
* to ATS and other subsystems.