struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+ const struct QuotaSetMessage *qsm;
+
+ qsm = (const struct QuotaSetMessage *) message;
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# SET QUOTA messages received"),
+ 1,
+ GNUNET_NO);
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received `%s' request (new quota %u) from client for peer `%4s'\n",
+ "SET_QUOTA",
+ (unsigned int) ntohl (qsm->quota.value__),
+ GNUNET_i2s (&qsm->peer));
+#endif
+ GST_neighbours_set_incoming_quota (&qsm->peer,
+ qsm->quota);
+ GNUNET_SERVER_receive_done (client, GNUNET_OK);
}
}
+/**
+ * Transmit a message to the given target using the active connection.
+ *
+ * @param target destination
+ * @param msg message to send
+ * @param cont function to call when done
+ * @param cont_cls closure for 'cont'
+ */
+void
+GST_neighbours_send (const struct GNUNET_PeerIdentity *target,
+ const struct GNUNET_MessageHeader *msg,
+ GST_NeighbourSendContinuation cont,
+ void *cont_cls)
+{
+}
+
+
+/**
+ * Change the incoming quota for the given peer.
+ *
+ * @param neighbour identity of peer to change qutoa for
+ * @param quota new quota
+ */
+void
+GST_neighbours_set_quota (const struct GNUNET_PeerIdentity *neighbour,
+ struct GNUNET_BANDWIDTH_Value32NBO quota)
+{
+#if 0
+
+ n = find_neighbour (neighbour);
+ if (n == NULL)
+ {
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# SET QUOTA messages ignored (no such peer)"),
+ 1,
+ GNUNET_NO);
+ return;
+ }
+ GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker,
+ quota);
+ if (0 != ntohl (qsm->quota.value__))
+ return;
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Disconnecting peer `%4s' due to `%s'\n",
+ GNUNET_i2s(&n->id),
+ "SET_QUOTA");
+#endif
+ GNUNET_STATISTICS_update (stats,
+ gettext_noop ("# disconnects due to quota of 0"),
+ 1,
+ GNUNET_NO);
+ GST_neighbours_force_disconnect (neighbour);
+
+#endif
+}
+
+
/**
* If we have an active connection to the given target, it must be shutdown.
*
void *cont_cls);
/**
- * Change the quota for the given peer.
- * FIXME: inbound or outbound quota?
+ * Change the incoming quota for the given peer.
*
* @param neighbour identity of peer to change qutoa for
- * @param quota new quota FIXME: fix type!
+ * @param quota new quota
*/
void
-GST_neighbours_set_quota (const struct GNUNET_PeerIdentity *neighbour,
- const float quota);
+GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour,
+ struct GNUNET_BANDWIDTH_Value32NBO quota);
/**