[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16384 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16384 - gnunet/src/transport |
Date: |
Fri, 5 Aug 2011 10:26:54 +0200 |
Author: grothoff
Date: 2011-08-05 10:26:53 +0200 (Fri, 05 Aug 2011)
New Revision: 16384
Modified:
gnunet/src/transport/gnunet-service-transport_clients.c
gnunet/src/transport/gnunet-service-transport_neighbours.c
gnunet/src/transport/gnunet-service-transport_neighbours.h
Log:
more client code
Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c 2011-08-05
08:18:52 UTC (rev 16383)
+++ gnunet/src/transport/gnunet-service-transport_clients.c 2011-08-05
08:26:53 UTC (rev 16384)
@@ -452,6 +452,23 @@
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);
}
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-08-05
08:18:52 UTC (rev 16383)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-08-05
08:26:53 UTC (rev 16384)
@@ -84,6 +84,64 @@
/**
+ * 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.
*
* @param target peer to disconnect from
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.h 2011-08-05
08:18:52 UTC (rev 16383)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.h 2011-08-05
08:26:53 UTC (rev 16384)
@@ -99,15 +99,14 @@
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);
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16384 - gnunet/src/transport,
gnunet <=