diff options
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 32 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.h | 4 | ||||
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 54 | ||||
-rw-r--r-- | 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 | |||
113 | * first field after header (this is where we start to encrypt!). | 113 | * first field after header (this is where we start to encrypt!). |
114 | */ | 114 | */ |
115 | uint32_t challenge GNUNET_PACKED; | 115 | uint32_t challenge GNUNET_PACKED; |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Desired bandwidth (how much we should send to this | 118 | * Reserved, always 'GNUNET_BANDWIDTH_VALUE_MAX'. |
119 | * peer / how much is the sender willing to receive). | ||
120 | */ | 119 | */ |
121 | struct GNUNET_BANDWIDTH_Value32NBO inbound_bw_limit; | 120 | struct GNUNET_BANDWIDTH_Value32NBO reserved; |
122 | 121 | ||
123 | /** | 122 | /** |
124 | * Intended target of the PING, used primarily to check | 123 | * Intended target of the PING, used primarily to check |
@@ -204,10 +203,9 @@ struct EncryptedMessage | |||
204 | uint32_t sequence_number GNUNET_PACKED; | 203 | uint32_t sequence_number GNUNET_PACKED; |
205 | 204 | ||
206 | /** | 205 | /** |
207 | * Desired bandwidth (how much we should send to this peer / how | 206 | * Reserved, always 'GNUNET_BANDWIDTH_VALUE_MAX'. |
208 | * much is the sender willing to receive)? | ||
209 | */ | 207 | */ |
210 | struct GNUNET_BANDWIDTH_Value32NBO inbound_bw_limit; | 208 | struct GNUNET_BANDWIDTH_Value32NBO reserved; |
211 | 209 | ||
212 | /** | 210 | /** |
213 | * Timestamp. Used to prevent reply of ancient messages | 211 | * Timestamp. Used to prevent reply of ancient messages |
@@ -899,7 +897,7 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, | |||
899 | return; | 897 | return; |
900 | } | 898 | } |
901 | /* construct PONG */ | 899 | /* construct PONG */ |
902 | tx.inbound_bw_limit = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; | 900 | tx.reserved = GNUNET_BANDWIDTH_VALUE_MAX; |
903 | /* FIXME: here we should ideally ask ATS about unassigned bandwidth and fill in | 901 | /* FIXME: here we should ideally ask ATS about unassigned bandwidth and fill in |
904 | a value based on that; using the minimum here results in a rather slow start... */ | 902 | a value based on that; using the minimum here results in a rather slow start... */ |
905 | tx.challenge = t.challenge; | 903 | tx.challenge = t.challenge; |
@@ -1124,13 +1122,9 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, const struct GNUNET_MessageH | |||
1124 | kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; | 1122 | kx->retry_set_key_task = GNUNET_SCHEDULER_NO_TASK; |
1125 | GNUNET_assert (kx->keep_alive_task == GNUNET_SCHEDULER_NO_TASK); | 1123 | GNUNET_assert (kx->keep_alive_task == GNUNET_SCHEDULER_NO_TASK); |
1126 | update_timeout (kx); | 1124 | update_timeout (kx); |
1127 | GSC_SESSIONS_update (&kx->peer, | ||
1128 | t.inbound_bw_limit); | ||
1129 | break; | 1125 | break; |
1130 | case KX_STATE_UP: | 1126 | case KX_STATE_UP: |
1131 | update_timeout (kx); | 1127 | update_timeout (kx); |
1132 | GSC_SESSIONS_update (&kx->peer, | ||
1133 | t.inbound_bw_limit); | ||
1134 | break; | 1128 | break; |
1135 | default: | 1129 | default: |
1136 | GNUNET_break (0); | 1130 | GNUNET_break (0); |
@@ -1204,15 +1198,11 @@ send_key (struct GSC_KeyExchangeInfo *kx) | |||
1204 | * Encrypt and transmit a message with the given payload. | 1198 | * Encrypt and transmit a message with the given payload. |
1205 | * | 1199 | * |
1206 | * @param kx key exchange context | 1200 | * @param kx key exchange context |
1207 | * @param bw_in bandwidth limit to transmit to the other peer; | ||
1208 | * the other peer shall not send us more than the | ||
1209 | * given rate | ||
1210 | * @param payload payload of the message | 1201 | * @param payload payload of the message |
1211 | * @param payload_size number of bytes in 'payload' | 1202 | * @param payload_size number of bytes in 'payload' |
1212 | */ | 1203 | */ |
1213 | void | 1204 | void |
1214 | GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | 1205 | GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, |
1215 | struct GNUNET_BANDWIDTH_Value32NBO bw_in, | ||
1216 | const void *payload, | 1206 | const void *payload, |
1217 | size_t payload_size) | 1207 | size_t payload_size) |
1218 | { | 1208 | { |
@@ -1224,18 +1214,12 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | |||
1224 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 1214 | struct GNUNET_CRYPTO_AesInitializationVector iv; |
1225 | struct GNUNET_CRYPTO_AuthKey auth_key; | 1215 | struct GNUNET_CRYPTO_AuthKey auth_key; |
1226 | 1216 | ||
1227 | #if DEBUG_CORE_QUOTA | ||
1228 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1229 | "Sending %u b/s as new limit to peer `%4s'\n", | ||
1230 | (unsigned int) ntohl (bw_in.value__), | ||
1231 | GNUNET_i2s (&kx->peer)); | ||
1232 | #endif | ||
1233 | ph = (struct EncryptedMessage*) pbuf; | 1217 | ph = (struct EncryptedMessage*) pbuf; |
1234 | ph->iv_seed = | 1218 | ph->iv_seed = |
1235 | htonl (GNUNET_CRYPTO_random_u32 | 1219 | htonl (GNUNET_CRYPTO_random_u32 |
1236 | (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX)); | 1220 | (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX)); |
1237 | ph->sequence_number = htonl (++kx->last_sequence_number_sent); | 1221 | ph->sequence_number = htonl (++kx->last_sequence_number_sent); |
1238 | ph->inbound_bw_limit = bw_in; | 1222 | ph->reserved = GNUNET_BANDWIDTH_VALUE_MAX; |
1239 | ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); | 1223 | ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); |
1240 | memcpy (&ph[1], payload, payload_size); | 1224 | memcpy (&ph[1], payload, payload_size); |
1241 | 1225 | ||
@@ -1409,8 +1393,6 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1409 | 1393 | ||
1410 | /* process decrypted message(s) */ | 1394 | /* process decrypted message(s) */ |
1411 | update_timeout (kx); | 1395 | update_timeout (kx); |
1412 | GSC_SESSIONS_update (&kx->peer, | ||
1413 | pt->inbound_bw_limit); | ||
1414 | GNUNET_STATISTICS_update (GSC_stats, | 1396 | GNUNET_STATISTICS_update (GSC_stats, |
1415 | gettext_noop ("# bytes of payload decrypted"), | 1397 | gettext_noop ("# bytes of payload decrypted"), |
1416 | size - sizeof (struct EncryptedMessage), GNUNET_NO); | 1398 | 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, | |||
75 | * Encrypt and transmit a message with the given payload. | 75 | * Encrypt and transmit a message with the given payload. |
76 | * | 76 | * |
77 | * @param kx key exchange context | 77 | * @param kx key exchange context |
78 | * @param bw_in bandwidth limit to transmit to the other peer; | ||
79 | * the other peer shall not send us more than the | ||
80 | * given rate | ||
81 | * @param payload payload of the message | 78 | * @param payload payload of the message |
82 | * @param payload_size number of bytes in 'payload' | 79 | * @param payload_size number of bytes in 'payload' |
83 | */ | 80 | */ |
84 | void | 81 | void |
85 | GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | 82 | GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, |
86 | struct GNUNET_BANDWIDTH_Value32NBO bw_in, | ||
87 | const void *payload, | 83 | const void *payload, |
88 | size_t payload_size); | 84 | size_t payload_size); |
89 | 85 | ||
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 | |||
@@ -122,33 +122,6 @@ struct Session | |||
122 | GNUNET_SCHEDULER_TaskIdentifier cork_task; | 122 | GNUNET_SCHEDULER_TaskIdentifier cork_task; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Available bandwidth out for this peer (current target). This | ||
126 | * value should be the 'MIN' of 'bw_out_internal_limit' and | ||
127 | * 'bw_out_external_limit'. | ||
128 | */ | ||
129 | struct GNUNET_BANDWIDTH_Value32NBO bw_out; | ||
130 | |||
131 | /** | ||
132 | * Internal bandwidth limit set for this peer (initially typically | ||
133 | * set to "MAX_INT"). Actual "bw_out" is MIN of | ||
134 | * "bpm_out_internal_limit" and "bw_out_external_limit". | ||
135 | * | ||
136 | * | ||
137 | * | ||
138 | * // FIXME: check usage | ||
139 | */ | ||
140 | struct GNUNET_BANDWIDTH_Value32NBO bw_out_internal_limit; | ||
141 | |||
142 | /** | ||
143 | * External bandwidth limit set for this peer by the | ||
144 | * peer that we are communicating with. "bw_out" is MIN of | ||
145 | * "bw_out_internal_limit" and "bw_out_external_limit". | ||
146 | * // FIXME: check usage | ||
147 | */ | ||
148 | struct GNUNET_BANDWIDTH_Value32NBO bw_out_external_limit; | ||
149 | |||
150 | |||
151 | /** | ||
152 | * Is the neighbour queue empty and thus ready for us | 125 | * Is the neighbour queue empty and thus ready for us |
153 | * to transmit an encrypted message? | 126 | * to transmit an encrypted message? |
154 | */ | 127 | */ |
@@ -249,19 +222,10 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
249 | gettext_noop ("# established sessions"), | 222 | gettext_noop ("# established sessions"), |
250 | GNUNET_CONTAINER_multihashmap_size (sessions), | 223 | GNUNET_CONTAINER_multihashmap_size (sessions), |
251 | GNUNET_NO); | 224 | GNUNET_NO); |
252 | #if 0 | ||
253 | /* FIXME: integration with ATS for quota calculations... */ | ||
254 | /* FIXME: who should do this? Neighbours!? */ | ||
255 | GNUNET_TRANSPORT_set_quota (transport, | ||
256 | peer, | ||
257 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, | ||
258 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT); | ||
259 | #endif | ||
260 | /* FIXME: we should probably do this periodically (in case | 225 | /* FIXME: we should probably do this periodically (in case |
261 | type map message is lost...) */ | 226 | type map message is lost...) */ |
262 | hdr = GSC_TYPEMAP_compute_type_map_message (); | 227 | hdr = GSC_TYPEMAP_compute_type_map_message (); |
263 | GSC_KX_encrypt_and_transmit (kx, | 228 | GSC_KX_encrypt_and_transmit (kx, |
264 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, | ||
265 | hdr, | 229 | hdr, |
266 | ntohs (hdr->size)); | 230 | ntohs (hdr->size)); |
267 | GNUNET_free (hdr); | 231 | GNUNET_free (hdr); |
@@ -539,7 +503,6 @@ try_transmission (struct Session *session) | |||
539 | /* now actually transmit... */ | 503 | /* now actually transmit... */ |
540 | session->ready_to_transmit = GNUNET_NO; | 504 | session->ready_to_transmit = GNUNET_NO; |
541 | GSC_KX_encrypt_and_transmit (session->kxinfo, | 505 | GSC_KX_encrypt_and_transmit (session->kxinfo, |
542 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT /* FIXME! */, | ||
543 | pbuf, | 506 | pbuf, |
544 | used); | 507 | used); |
545 | } | 508 | } |
@@ -726,23 +689,6 @@ GSC_SESSIONS_handle_client_have_peer (void *cls, struct GNUNET_SERVER_Client *cl | |||
726 | 689 | ||
727 | 690 | ||
728 | /** | 691 | /** |
729 | * Update information about a session. | ||
730 | * | ||
731 | * @param peer peer who's session should be updated | ||
732 | * @param bw_out new outbound bandwidth limit for the peer | ||
733 | * @param atsi performance information | ||
734 | * @param atsi_count number of performance records supplied | ||
735 | */ | ||
736 | void | ||
737 | GSC_SESSIONS_update (const struct GNUNET_PeerIdentity *peer, | ||
738 | struct GNUNET_BANDWIDTH_Value32NBO bw_out) | ||
739 | { | ||
740 | // FIXME | ||
741 | /* not implemented */ | ||
742 | } | ||
743 | |||
744 | |||
745 | /** | ||
746 | * Initialize sessions subsystem. | 692 | * Initialize sessions subsystem. |
747 | */ | 693 | */ |
748 | void | 694 | void |
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 | |||
@@ -42,17 +42,6 @@ GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer, | |||
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Update information about a session. | ||
46 | * | ||
47 | * @param peer peer who's session should be updated | ||
48 | * @param bw_out new outbound bandwidth limit for the peer | ||
49 | */ | ||
50 | void | ||
51 | GSC_SESSIONS_update (const struct GNUNET_PeerIdentity *peer, | ||
52 | struct GNUNET_BANDWIDTH_Value32NBO bw_out); | ||
53 | |||
54 | |||
55 | /** | ||
56 | * End the session with the given peer (we are no longer | 45 | * End the session with the given peer (we are no longer |
57 | * connected). | 46 | * connected). |
58 | * | 47 | * |