[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17667 - in gnunet/src: include transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17667 - in gnunet/src: include transport |
Date: |
Sat, 22 Oct 2011 22:16:14 +0200 |
Author: grothoff
Date: 2011-10-22 22:16:14 +0200 (Sat, 22 Oct 2011)
New Revision: 17667
Modified:
gnunet/src/include/gnunet_transport_service.h
gnunet/src/transport/gnunet-service-transport.c
gnunet/src/transport/gnunet-service-transport_clients.c
gnunet/src/transport/transport.h
gnunet/src/transport/transport_api.c
Log:
eliminating GNUNET_TRANSPORT_set_quota code
Modified: gnunet/src/include/gnunet_transport_service.h
===================================================================
--- gnunet/src/include/gnunet_transport_service.h 2011-10-21 22:42:58 UTC
(rev 17666)
+++ gnunet/src/include/gnunet_transport_service.h 2011-10-22 20:16:14 UTC
(rev 17667)
@@ -170,22 +170,6 @@
/**
- * Set the share of incoming/outgoing bandwidth for the given
- * peer to the specified amount.
- *
- * @param handle connection to transport service
- * @param target who's bandwidth quota is being changed
- * @param quota_in incoming bandwidth quota
- * @param quota_out outgoing bandwidth quota
- */
-void
-GNUNET_TRANSPORT_set_quota (struct GNUNET_TRANSPORT_Handle *handle,
- const struct GNUNET_PeerIdentity *target,
- struct GNUNET_BANDWIDTH_Value32NBO quota_in,
- struct GNUNET_BANDWIDTH_Value32NBO quota_out);
-
-
-/**
* Opaque handle for a transmission-ready request.
*/
struct GNUNET_TRANSPORT_TransmitHandle;
Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c 2011-10-21 22:42:58 UTC
(rev 17666)
+++ gnunet/src/transport/gnunet-service-transport.c 2011-10-22 20:16:14 UTC
(rev 17667)
@@ -404,8 +404,11 @@
/* ATS tells me to disconnect from peer*/
if ((bw_in == 0) && (bw_out == 0))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS tells me to disconnect from peer
`%s'\n",
- GNUNET_i2s (peer));
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ATS tells me to disconnect from peer `%s'\n",
+ GNUNET_i2s (peer));
+#endif
GST_neighbours_force_disconnect(peer);
return;
}
Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c 2011-10-21
22:42:58 UTC (rev 17666)
+++ gnunet/src/transport/gnunet-service-transport_clients.c 2011-10-22
20:16:14 UTC (rev 17667)
@@ -600,34 +600,6 @@
/**
- * Client asked for a quota change for a particular peer. Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the quota changing message
- */
-static void
-clients_handle_set_quota (void *cls, struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
-{
- const struct QuotaSetMessage *qsm;
-
- qsm = (const struct QuotaSetMessage *) message;
- GNUNET_STATISTICS_update (GST_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);
-}
-
-
-/**
* Take the given address and append it to the set of results sent back to
* the client.
*
@@ -883,8 +855,6 @@
{&clients_handle_request_connect, NULL,
GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT,
sizeof (struct TransportRequestConnectMessage)},
- {&clients_handle_set_quota, NULL,
- GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA, sizeof (struct QuotaSetMessage)},
{&clients_handle_address_lookup, NULL,
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP, 0},
{&clients_handle_peer_address_lookup, NULL,
Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h 2011-10-21 22:42:58 UTC (rev 17666)
+++ gnunet/src/transport/transport.h 2011-10-22 20:16:14 UTC (rev 17667)
@@ -176,7 +176,7 @@
{
/**
- * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_NEIGHBOUR_INFO
+ * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA
*/
struct GNUNET_MessageHeader header;
Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c 2011-10-21 22:42:58 UTC (rev
17666)
+++ gnunet/src/transport/transport_api.c 2011-10-22 20:16:14 UTC (rev
17667)
@@ -972,105 +972,6 @@
/**
- * Closure for 'send_set_quota'.
- */
-struct SetQuotaContext
-{
-
- /**
- * Identity of the peer impacted by the quota change.
- */
- struct GNUNET_PeerIdentity target;
-
- /**
- * Quota to transmit.
- */
- struct GNUNET_BANDWIDTH_Value32NBO quota_in;
-};
-
-
-/**
- * Send SET_QUOTA message to the service.
- *
- * @param cls the 'struct SetQuotaContext'
- * @param size number of bytes available in buf
- * @param buf where to copy the message
- * @return number of bytes copied to buf
- */
-static size_t
-send_set_quota (void *cls, size_t size, void *buf)
-{
- struct SetQuotaContext *sqc = cls;
- struct QuotaSetMessage msg;
-
- if (buf == NULL)
- {
- GNUNET_free (sqc);
- return 0;
- }
-#if DEBUG_TRANSPORT_API
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitting `%s' request with respect to `%4s'.\n", "SET_QUOTA",
- GNUNET_i2s (&sqc->target));
-#endif
- GNUNET_assert (size >= sizeof (struct QuotaSetMessage));
- msg.header.size = htons (sizeof (struct QuotaSetMessage));
- msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
- msg.quota = sqc->quota_in;
- msg.peer = sqc->target;
- memcpy (buf, &msg, sizeof (msg));
- GNUNET_free (sqc);
- return sizeof (struct QuotaSetMessage);
-}
-
-
-/**
- * Set the share of incoming bandwidth for the given
- * peer to the specified amount.
- *
- * @param handle connection to transport service
- * @param target who's bandwidth quota is being changed
- * @param quota_in incoming bandwidth quota in bytes per ms
- * @param quota_out outgoing bandwidth quota in bytes per ms
- */
-void
-GNUNET_TRANSPORT_set_quota (struct GNUNET_TRANSPORT_Handle *handle,
- const struct GNUNET_PeerIdentity *target,
- struct GNUNET_BANDWIDTH_Value32NBO quota_in,
- struct GNUNET_BANDWIDTH_Value32NBO quota_out)
-{
- struct Neighbour *n;
- struct SetQuotaContext *sqc;
-
- n = neighbour_find (handle, target);
- if (NULL == n)
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "Quota changed to %u for peer `%s', but I have no such neighbour!\n",
- (unsigned int) ntohl (quota_out.value__), GNUNET_i2s (target));
- return;
- }
- GNUNET_assert (NULL != handle->client);
-#if DEBUG_TRANSPORT_API
- if (ntohl (quota_out.value__) != n->out_tracker.available_bytes_per_s__)
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Quota changed from %u to %u for peer
`%s'\n",
- (unsigned int) n->out_tracker.available_bytes_per_s__,
- (unsigned int) ntohl (quota_out.value__), GNUNET_i2s (target));
- else
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Quota remains at %u for peer `%s'\n",
- (unsigned int) n->out_tracker.available_bytes_per_s__,
- GNUNET_i2s (target));
-#endif
- GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, quota_out);
- sqc = GNUNET_malloc (sizeof (struct SetQuotaContext));
- sqc->target = *target;
- sqc->quota_in = quota_in;
- schedule_control_transmit (handle, sizeof (struct QuotaSetMessage),
- &send_set_quota, sqc);
-}
-
-
-/**
* Send REQUEST_CONNECT message to the service.
*
* @param cls the 'struct GNUNET_PeerIdentity'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17667 - in gnunet/src: include transport,
gnunet <=