From 0678e1f1225793524bc030b82d73cbad12efee56 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 10 Oct 2011 11:20:35 +0000 Subject: [PATCH] removing dead bw code --- src/core/gnunet-service-core_kx.c | 32 ++++----------- src/core/gnunet-service-core_kx.h | 4 -- src/core/gnunet-service-core_sessions.c | 54 ------------------------- src/core/gnunet-service-core_sessions.h | 11 ----- 4 files changed, 7 insertions(+), 94 deletions(-) diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 5c3098194..6d10c9022 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c @@ -113,12 +113,11 @@ struct PongMessage * first field after header (this is where we start to encrypt!). */ uint32_t challenge GNUNET_PACKED; - + /** - * Desired bandwidth (how much we should send to this - * peer / how much is the sender willing to receive). + * Reserved, always 'GNUNET_BANDWIDTH_VALUE_MAX'. */ - struct GNUNET_BANDWIDTH_Value32NBO inbound_bw_limit; + struct GNUNET_BANDWIDTH_Value32NBO reserved; /** * Intended target of the PING, used primarily to check @@ -204,10 +203,9 @@ struct EncryptedMessage uint32_t sequence_number GNUNET_PACKED; /** - * Desired bandwidth (how much we should send to this peer / how - * much is the sender willing to receive)? + * Reserved, always 'GNUNET_BANDWIDTH_VALUE_MAX'. */ - struct GNUNET_BANDWIDTH_Value32NBO inbound_bw_limit; + struct GNUNET_BANDWIDTH_Value32NBO reserved; /** * Timestamp. Used to prevent reply of ancient messages @@ -899,7 +897,7 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, return; } /* construct PONG */ - tx.inbound_bw_limit = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; + tx.reserved = GNUNET_BANDWIDTH_VALUE_MAX; /* FIXME: here we should ideally ask ATS about unassigned bandwidth and fill in a value based on that; using the minimum here results in a rather slow start... */ tx.challenge = t.challenge; @@ -1124,13 +1122,9 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, const struct GNUNET_MessageH kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; GNUNET_assert (kx->keep_alive_task == GNUNET_SCHEDULER_NO_TASK); update_timeout (kx); - GSC_SESSIONS_update (&kx->peer, - t.inbound_bw_limit); break; case KX_STATE_UP: update_timeout (kx); - GSC_SESSIONS_update (&kx->peer, - t.inbound_bw_limit); break; default: GNUNET_break (0); @@ -1204,15 +1198,11 @@ send_key (struct GSC_KeyExchangeInfo *kx) * Encrypt and transmit a message with the given payload. * * @param kx key exchange context - * @param bw_in bandwidth limit to transmit to the other peer; - * the other peer shall not send us more than the - * given rate * @param payload payload of the message * @param payload_size number of bytes in 'payload' */ void GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, - struct GNUNET_BANDWIDTH_Value32NBO bw_in, const void *payload, size_t payload_size) { @@ -1224,18 +1214,12 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, struct GNUNET_CRYPTO_AesInitializationVector iv; struct GNUNET_CRYPTO_AuthKey auth_key; -#if DEBUG_CORE_QUOTA - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending %u b/s as new limit to peer `%4s'\n", - (unsigned int) ntohl (bw_in.value__), - GNUNET_i2s (&kx->peer)); -#endif ph = (struct EncryptedMessage*) pbuf; ph->iv_seed = htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX)); ph->sequence_number = htonl (++kx->last_sequence_number_sent); - ph->inbound_bw_limit = bw_in; + ph->reserved = GNUNET_BANDWIDTH_VALUE_MAX; ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); memcpy (&ph[1], payload, payload_size); @@ -1409,8 +1393,6 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, /* process decrypted message(s) */ update_timeout (kx); - GSC_SESSIONS_update (&kx->peer, - pt->inbound_bw_limit); GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# bytes of payload decrypted"), size - sizeof (struct EncryptedMessage), GNUNET_NO); diff --git a/src/core/gnunet-service-core_kx.h b/src/core/gnunet-service-core_kx.h index 0395f68ed..3c6734d77 100644 --- a/src/core/gnunet-service-core_kx.h +++ b/src/core/gnunet-service-core_kx.h @@ -75,15 +75,11 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, * Encrypt and transmit a message with the given payload. * * @param kx key exchange context - * @param bw_in bandwidth limit to transmit to the other peer; - * the other peer shall not send us more than the - * given rate * @param payload payload of the message * @param payload_size number of bytes in 'payload' */ void GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, - struct GNUNET_BANDWIDTH_Value32NBO bw_in, const void *payload, size_t payload_size); diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index c82c72863..4a3fc1e87 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c @@ -121,33 +121,6 @@ struct Session */ GNUNET_SCHEDULER_TaskIdentifier cork_task; - /** - * Available bandwidth out for this peer (current target). This - * value should be the 'MIN' of 'bw_out_internal_limit' and - * 'bw_out_external_limit'. - */ - struct GNUNET_BANDWIDTH_Value32NBO bw_out; - - /** - * Internal bandwidth limit set for this peer (initially typically - * set to "MAX_INT"). Actual "bw_out" is MIN of - * "bpm_out_internal_limit" and "bw_out_external_limit". - * - * - * - * // FIXME: check usage - */ - struct GNUNET_BANDWIDTH_Value32NBO bw_out_internal_limit; - - /** - * External bandwidth limit set for this peer by the - * peer that we are communicating with. "bw_out" is MIN of - * "bw_out_internal_limit" and "bw_out_external_limit". - * // FIXME: check usage - */ - struct GNUNET_BANDWIDTH_Value32NBO bw_out_external_limit; - - /** * Is the neighbour queue empty and thus ready for us * to transmit an encrypted message? @@ -249,19 +222,10 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, gettext_noop ("# established sessions"), GNUNET_CONTAINER_multihashmap_size (sessions), GNUNET_NO); -#if 0 - /* FIXME: integration with ATS for quota calculations... */ - /* FIXME: who should do this? Neighbours!? */ - GNUNET_TRANSPORT_set_quota (transport, - peer, - GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, - GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT); -#endif /* FIXME: we should probably do this periodically (in case type map message is lost...) */ hdr = GSC_TYPEMAP_compute_type_map_message (); GSC_KX_encrypt_and_transmit (kx, - GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, hdr, ntohs (hdr->size)); GNUNET_free (hdr); @@ -539,7 +503,6 @@ try_transmission (struct Session *session) /* now actually transmit... */ session->ready_to_transmit = GNUNET_NO; GSC_KX_encrypt_and_transmit (session->kxinfo, - GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT /* FIXME! */, pbuf, used); } @@ -725,23 +688,6 @@ GSC_SESSIONS_handle_client_have_peer (void *cls, struct GNUNET_SERVER_Client *cl } -/** - * Update information about a session. - * - * @param peer peer who's session should be updated - * @param bw_out new outbound bandwidth limit for the peer - * @param atsi performance information - * @param atsi_count number of performance records supplied - */ -void -GSC_SESSIONS_update (const struct GNUNET_PeerIdentity *peer, - struct GNUNET_BANDWIDTH_Value32NBO bw_out) -{ - // FIXME - /* not implemented */ -} - - /** * Initialize sessions subsystem. */ diff --git a/src/core/gnunet-service-core_sessions.h b/src/core/gnunet-service-core_sessions.h index 4bc073b65..a795c417c 100644 --- a/src/core/gnunet-service-core_sessions.h +++ b/src/core/gnunet-service-core_sessions.h @@ -41,17 +41,6 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, struct GSC_KeyExchangeInfo *kx); -/** - * Update information about a session. - * - * @param peer peer who's session should be updated - * @param bw_out new outbound bandwidth limit for the peer - */ -void -GSC_SESSIONS_update (const struct GNUNET_PeerIdentity *peer, - struct GNUNET_BANDWIDTH_Value32NBO bw_out); - - /** * End the session with the given peer (we are no longer * connected). -- 2.25.1