diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-13 13:06:01 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-13 13:06:01 +0000 |
commit | f40b9f4d92412da3a1461f16069c8bbb425bd136 (patch) | |
tree | a1f9df4553aace1af037e465fe39b0f00a05c116 | |
parent | 86ad1393cdf6c8b37437c330fce25ebfffbc8ffd (diff) | |
download | gnunet-f40b9f4d92412da3a1461f16069c8bbb425bd136.tar.gz gnunet-f40b9f4d92412da3a1461f16069c8bbb425bd136.zip |
compile
-rw-r--r-- | src/transport/gnunet-service-transport.c | 43 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 90 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 23 | ||||
-rw-r--r-- | src/transport/plugin_transport_http.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 15 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_unix.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 10 |
8 files changed, 67 insertions, 144 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index ce4c240a7..e551cbf49 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -246,7 +246,6 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
246 | break; | 246 | break; |
247 | } | 247 | } |
248 | } | 248 | } |
249 | GNUNET_assert ((ats_count > 0) && (ats != NULL)); | ||
250 | /* | 249 | /* |
251 | FIXME: this gives an address that might not have been validated to | 250 | FIXME: this gives an address that might not have been validated to |
252 | ATS for 'selection', which is probably not what we want; this | 251 | ATS for 'selection', which is probably not what we want; this |
@@ -254,9 +253,11 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
254 | validation) as 'GNUNET_ATS_address_update' currently ignores | 253 | validation) as 'GNUNET_ATS_address_update' currently ignores |
255 | the expiration given. | 254 | the expiration given. |
256 | */ | 255 | */ |
257 | GNUNET_ATS_address_update (GST_ats, peer, GNUNET_TIME_absolute_get (), /* valid at least until right now... */ | 256 | if ((ats_count > 0) && (ats != NULL)) |
258 | plugin_name, session, sender_address, | 257 | GNUNET_ATS_address_update (GST_ats, peer, |
259 | sender_address_len, ats, ats_count); | 258 | plugin_name, sender_address, sender_address_len, |
259 | session, | ||
260 | ats, ats_count); | ||
260 | return ret; | 261 | return ret; |
261 | } | 262 | } |
262 | 263 | ||
@@ -304,7 +305,7 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
304 | "Session %X to peer `%s' ended \n", | 305 | "Session %X to peer `%s' ended \n", |
305 | session, GNUNET_i2s (peer)); | 306 | session, GNUNET_i2s (peer)); |
306 | #endif | 307 | #endif |
307 | GNUNET_ATS_session_destroyed(GST_ats, peer, session); | 308 | GNUNET_ATS_address_destroyed(GST_ats, peer, NULL, NULL, 0, session); |
308 | GST_neighbours_session_terminated (peer, session); | 309 | GST_neighbours_session_terminated (peer, session); |
309 | } | 310 | } |
310 | 311 | ||
@@ -327,15 +328,32 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
327 | */ | 328 | */ |
328 | static void | 329 | static void |
329 | ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer, | 330 | ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer, |
330 | const char *plugin_name, struct Session *session, | 331 | const char *plugin_name, |
331 | const void *plugin_addr, size_t plugin_addr_len, | 332 | const void *plugin_addr, size_t plugin_addr_len, |
333 | struct Session *session, | ||
332 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 334 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
333 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) | 335 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
334 | { | 336 | { |
335 | GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr, | 337 | GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr, |
336 | plugin_addr_len, session, NULL, 0); | 338 | plugin_addr_len, session, NULL, 0); |
337 | GST_neighbours_set_incoming_quota (peer, bandwidth_in); | 339 | GST_neighbours_set_incoming_quota (peer, bandwidth_in); |
338 | // FIXME: use 'bandwidth_out'! | 340 | |
341 | #if DEBUG_TRANSPORT | ||
342 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | ||
343 | ntohl (bandwidth_out.value__), GNUNET_i2s (target)); | ||
344 | #endif | ||
345 | struct QuotaSetMessage msg; | ||
346 | msg.header.size = htons (sizeof (struct QuotaSetMessage)); | ||
347 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | ||
348 | msg.quota = bandwidth_out; | ||
349 | msg.peer = (*peer); | ||
350 | GST_clients_broadcast ((struct GNUNET_MessageHeader *) &msg, GNUNET_NO); | ||
351 | |||
352 | #if DEBUG_TRANSPORT | ||
353 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting inbound quota of %u for peer `%s' to \n", | ||
354 | ntohl (bandwidth_in.value__), GNUNET_i2s (target)); | ||
355 | #endif | ||
356 | GST_neighbours_set_incoming_quota (peer, bandwidth_in); | ||
339 | } | 357 | } |
340 | 358 | ||
341 | 359 | ||
@@ -346,7 +364,7 @@ ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
346 | * @param cls closure | 364 | * @param cls closure |
347 | * @param peer the peer that connected | 365 | * @param peer the peer that connected |
348 | * @param ats performance data | 366 | * @param ats performance data |
349 | * @param ats_count number of entries in ats (excluding 0-termination) | 367 | * @param ats_count number of entries in ats |
350 | */ | 368 | */ |
351 | static void | 369 | static void |
352 | neighbours_connect_notification (void *cls, | 370 | neighbours_connect_notification (void *cls, |
@@ -357,16 +375,13 @@ neighbours_connect_notification (void *cls, | |||
357 | char buf[sizeof (struct ConnectInfoMessage) + | 375 | char buf[sizeof (struct ConnectInfoMessage) + |
358 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)]; | 376 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)]; |
359 | struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf; | 377 | struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf; |
360 | struct GNUNET_TRANSPORT_ATS_Information *atsm = &connect_msg->ats; | ||
361 | 378 | ||
362 | connect_msg->header.size = htons (sizeof (buf)); | 379 | connect_msg->header.size = htons (sizeof (buf)); |
363 | connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 380 | connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
364 | connect_msg->ats_count = htonl (ats_count); | 381 | connect_msg->ats_count = htonl (ats_count); |
365 | connect_msg->id = *peer; | 382 | connect_msg->id = *peer; |
366 | memcpy (&connect_msg->ats, ats, | 383 | memcpy (&connect_msg->ats, &connect_msg->ats, |
367 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); | 384 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); |
368 | atsm[ats_count].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
369 | atsm[ats_count].value = htonl (0); | ||
370 | GST_clients_broadcast (&connect_msg->header, GNUNET_NO); | 385 | GST_clients_broadcast (&connect_msg->header, GNUNET_NO); |
371 | } | 386 | } |
372 | 387 | ||
@@ -405,7 +420,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
405 | GST_validation_stop (); | 420 | GST_validation_stop (); |
406 | GST_plugins_unload (); | 421 | GST_plugins_unload (); |
407 | GST_neighbours_stop (); | 422 | GST_neighbours_stop (); |
408 | GNUNET_ATS_shutdown (GST_ats); | 423 | GNUNET_ATS_scheduling_done (GST_ats); |
409 | GST_ats = NULL; | 424 | GST_ats = NULL; |
410 | GST_clients_stop (); | 425 | GST_clients_stop (); |
411 | GST_blacklist_stop (); | 426 | GST_blacklist_stop (); |
@@ -484,7 +499,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
484 | GST_plugins_load (&plugin_env_receive_callback, | 499 | GST_plugins_load (&plugin_env_receive_callback, |
485 | &plugin_env_address_change_notification, | 500 | &plugin_env_address_change_notification, |
486 | &plugin_env_session_end); | 501 | &plugin_env_session_end); |
487 | GST_ats = GNUNET_ATS_init (GST_cfg, &ats_request_address_change, NULL); | 502 | GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, &ats_request_address_change, NULL); |
488 | GST_neighbours_start (NULL, &neighbours_connect_notification, | 503 | GST_neighbours_start (NULL, &neighbours_connect_notification, |
489 | &neighbours_disconnect_notification); | 504 | &neighbours_disconnect_notification); |
490 | GST_clients_start (server); | 505 | GST_clients_start (server); |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index cbcc50b42..5c17648a8 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -191,12 +191,6 @@ struct NeighbourMapEntry | |||
191 | struct MessageQueue *messages_tail; | 191 | struct MessageQueue *messages_tail; |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Context for address suggestion. | ||
195 | * NULL after we are connected. | ||
196 | */ | ||
197 | struct GNUNET_ATS_SuggestionContext *asc; | ||
198 | |||
199 | /** | ||
200 | * Performance data for the peer. | 194 | * Performance data for the peer. |
201 | */ | 195 | */ |
202 | struct GNUNET_TRANSPORT_ATS_Information *ats; | 196 | struct GNUNET_TRANSPORT_ATS_Information *ats; |
@@ -505,11 +499,6 @@ disconnect_neighbour (struct NeighbourMapEntry *n) | |||
505 | GNUNET_SCHEDULER_cancel (n->transmission_task); | 499 | GNUNET_SCHEDULER_cancel (n->transmission_task); |
506 | n->transmission_task = GNUNET_SCHEDULER_NO_TASK; | 500 | n->transmission_task = GNUNET_SCHEDULER_NO_TASK; |
507 | } | 501 | } |
508 | if (NULL != n->asc) | ||
509 | { | ||
510 | GNUNET_ATS_suggest_address_cancel (n->asc); | ||
511 | n->asc = NULL; | ||
512 | } | ||
513 | GNUNET_array_grow (n->ats, n->ats_count, 0); | 502 | GNUNET_array_grow (n->ats, n->ats_count, 0); |
514 | if (NULL != n->plugin_name) | 503 | if (NULL != n->plugin_name) |
515 | { | 504 | { |
@@ -649,6 +638,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
649 | { | 638 | { |
650 | struct NeighbourMapEntry *n; | 639 | struct NeighbourMapEntry *n; |
651 | struct SessionConnectMessage connect_msg; | 640 | struct SessionConnectMessage connect_msg; |
641 | int was_connected; | ||
652 | 642 | ||
653 | GNUNET_assert (neighbours != NULL); | 643 | GNUNET_assert (neighbours != NULL); |
654 | 644 | ||
@@ -660,6 +650,8 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
660 | // GNUNET_break (0); | 650 | // GNUNET_break (0); |
661 | return; | 651 | return; |
662 | } | 652 | } |
653 | was_connected = n->is_connected; | ||
654 | n->is_connected = GNUNET_YES; | ||
663 | 655 | ||
664 | #if DEBUG_TRANSPORT | 656 | #if DEBUG_TRANSPORT |
665 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 657 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -693,76 +685,18 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
693 | GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); | 685 | GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); |
694 | GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), | 686 | GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), |
695 | GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); | 687 | GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); |
696 | } | ||
697 | 688 | ||
698 | 689 | n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, | |
699 | /** | 690 | n); |
700 | * Try to connect to the target peer using the given address | ||
701 | * | ||
702 | * @param cls the 'struct NeighbourMapEntry' of the target | ||
703 | * @param target identity of the target peer | ||
704 | * @param plugin_name name of the plugin | ||
705 | * @param plugin_address binary address | ||
706 | * @param plugin_address_len length of address | ||
707 | * @param session session to use | ||
708 | * @param bandwidth_out available outbound bandwidth | ||
709 | * @param bandwidth_in available inbound bandwidth | ||
710 | * @param ats performance data for the address (as far as known) | ||
711 | * @param ats_count number of performance records in 'ats' | ||
712 | */ | ||
713 | static void | ||
714 | try_connect_using_address (void *cls, const struct GNUNET_PeerIdentity *target, | ||
715 | const char *plugin_name, const void *plugin_address, | ||
716 | size_t plugin_address_len, struct Session *session, | ||
717 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | ||
718 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | ||
719 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | ||
720 | uint32_t ats_count) | ||
721 | { | ||
722 | struct NeighbourMapEntry *n = cls; | ||
723 | int was_connected; | ||
724 | |||
725 | n->asc = NULL; | ||
726 | was_connected = n->is_connected; | ||
727 | n->is_connected = GNUNET_YES; | ||
728 | |||
729 | GST_neighbours_switch_to_address (target, plugin_name, plugin_address, | ||
730 | plugin_address_len, session, ats, | ||
731 | ats_count); | ||
732 | if (GNUNET_YES == was_connected) | 691 | if (GNUNET_YES == was_connected) |
733 | return; | 692 | return; |
734 | n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, | ||
735 | n); | ||
736 | |||
737 | /* ATS told us inbound quota for this peer */ | ||
738 | #if DEBUG_TRANSPORT | ||
739 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting inbound quota of %u for peer `%s' to \n", | ||
740 | ntohl (bandwidth_in.value__), GNUNET_i2s (target)); | ||
741 | #endif | ||
742 | GST_neighbours_set_incoming_quota (&n->id, bandwidth_in); | ||
743 | |||
744 | /* First tell clients about connected neighbours...*/ | 693 | /* First tell clients about connected neighbours...*/ |
745 | neighbours_connected++; | 694 | neighbours_connected++; |
746 | GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1, | 695 | GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1, |
747 | GNUNET_NO); | 696 | GNUNET_NO); |
748 | connect_notify_cb (callback_cls, target, n->ats, n->ats_count); | 697 | connect_notify_cb (callback_cls, peer, n->ats, n->ats_count); |
749 | |||
750 | /* ... then send outbound quota for this peer to all clients */ | ||
751 | #if DEBUG_TRANSPORT | ||
752 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | ||
753 | ntohl (bandwidth_out.value__), GNUNET_i2s (target)); | ||
754 | #endif | ||
755 | |||
756 | struct QuotaSetMessage msg; | ||
757 | msg.header.size = htons (sizeof (struct QuotaSetMessage)); | ||
758 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | ||
759 | msg.quota = bandwidth_out; | ||
760 | msg.peer = (*target); | ||
761 | GST_clients_broadcast ((struct GNUNET_MessageHeader *) &msg, GNUNET_NO); | ||
762 | |||
763 | } | 698 | } |
764 | 699 | ||
765 | |||
766 | /** | 700 | /** |
767 | * Try to create a connection to the given target (eventually). | 701 | * Try to create a connection to the given target (eventually). |
768 | * | 702 | * |
@@ -795,9 +729,6 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) | |||
795 | #endif | 729 | #endif |
796 | n = GNUNET_malloc (sizeof (struct NeighbourMapEntry)); | 730 | n = GNUNET_malloc (sizeof (struct NeighbourMapEntry)); |
797 | n->id = *target; | 731 | n->id = *target; |
798 | GNUNET_array_grow (n->ats, n->ats_count, 1); | ||
799 | n->ats[0].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);; | ||
800 | n->ats[0].value = htonl (0); | ||
801 | GNUNET_BANDWIDTH_tracker_init (&n->in_tracker, | 732 | GNUNET_BANDWIDTH_tracker_init (&n->in_tracker, |
802 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, | 733 | GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, |
803 | MAX_BANDWIDTH_CARRY_S); | 734 | MAX_BANDWIDTH_CARRY_S); |
@@ -809,16 +740,12 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) | |||
809 | &n->id.hashPubKey, n, | 740 | &n->id.hashPubKey, n, |
810 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 741 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
811 | } | 742 | } |
812 | if (n->asc != NULL) | ||
813 | return; /* already trying */ | ||
814 | #if DEBUG_TRANSPORT | 743 | #if DEBUG_TRANSPORT |
815 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 744 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
816 | "Asking ATS for suggested address to connect to peer `%s'\n", | 745 | "Asking ATS for suggested address to connect to peer `%s'\n", |
817 | GNUNET_i2s (target)); | 746 | GNUNET_i2s (target)); |
818 | #endif | 747 | #endif |
819 | n->asc = | 748 | GNUNET_ATS_suggest_address (GST_ats, target); |
820 | GNUNET_ATS_suggest_address (GST_ats, target, &try_connect_using_address, | ||
821 | n); | ||
822 | } | 749 | } |
823 | 750 | ||
824 | 751 | ||
@@ -891,8 +818,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, | |||
891 | //GNUNET_break (0); | 818 | //GNUNET_break (0); |
892 | return; | 819 | return; |
893 | } | 820 | } |
894 | n->asc = | 821 | GNUNET_ATS_suggest_address (GST_ats, peer); |
895 | GNUNET_ATS_suggest_address (GST_ats, peer, &try_connect_using_address, n); | ||
896 | } | 822 | } |
897 | 823 | ||
898 | 824 | ||
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index e16ccb56b..f0cc12e41 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -394,7 +394,6 @@ add_valid_address (void *cls, const char *tname, | |||
394 | struct ValidationEntry *ve; | 394 | struct ValidationEntry *ve; |
395 | struct GNUNET_PeerIdentity pid; | 395 | struct GNUNET_PeerIdentity pid; |
396 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key; | 396 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key; |
397 | struct GNUNET_TRANSPORT_ATS_Information ats; | ||
398 | 397 | ||
399 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) | 398 | if (GNUNET_TIME_absolute_get_remaining (expiration).rel_value == 0) |
400 | return GNUNET_OK; /* expired */ | 399 | return GNUNET_OK; /* expired */ |
@@ -406,10 +405,8 @@ add_valid_address (void *cls, const char *tname, | |||
406 | } | 405 | } |
407 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); | 406 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); |
408 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); | 407 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); |
409 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | 408 | GNUNET_ATS_address_update (GST_ats, &pid, tname, addr, |
410 | ats.value = htonl (0); | 409 | addrlen, NULL, NULL, 0); |
411 | GNUNET_ATS_address_update (GST_ats, &pid, ve->valid_until, tname, NULL, addr, | ||
412 | addrlen, &ats, 1); | ||
413 | return GNUNET_OK; | 410 | return GNUNET_OK; |
414 | } | 411 | } |
415 | 412 | ||
@@ -978,15 +975,13 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
978 | /* validity achieved, remember it! */ | 975 | /* validity achieved, remember it! */ |
979 | ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); | 976 | ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); |
980 | { | 977 | { |
981 | struct GNUNET_TRANSPORT_ATS_Information ats[2]; | 978 | struct GNUNET_TRANSPORT_ATS_Information ats; |
982 | 979 | ||
983 | ats[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY); | 980 | ats.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY); |
984 | ats[0].value = htonl ((uint32_t) GNUNET_TIME_absolute_get_duration (ve->send_time).rel_value); | 981 | ats.value = htonl ((uint32_t) GNUNET_TIME_absolute_get_duration (ve->send_time).rel_value); |
985 | ats[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | 982 | GNUNET_ATS_address_update (GST_ats, &ve->pid, |
986 | ats[1].value = htonl (0); | 983 | ve->transport_name,ve->addr, ve->addrlen, NULL, |
987 | GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, | 984 | &ats, 1); |
988 | ve->transport_name, NULL, ve->addr, ve->addrlen, | ||
989 | ats, 2); | ||
990 | } | 985 | } |
991 | 986 | ||
992 | /* build HELLO to store in PEERINFO */ | 987 | /* build HELLO to store in PEERINFO */ |
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 3f7ff2a40..7e740293b 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -257,15 +257,13 @@ http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer, | |||
257 | { | 257 | { |
258 | struct Session *s = cls; | 258 | struct Session *s = cls; |
259 | struct Plugin *plugin = s->plugin; | 259 | struct Plugin *plugin = s->plugin; |
260 | struct GNUNET_TRANSPORT_ATS_Information distance[2]; | 260 | struct GNUNET_TRANSPORT_ATS_Information distance; |
261 | struct GNUNET_TIME_Relative delay; | 261 | struct GNUNET_TIME_Relative delay; |
262 | 262 | ||
263 | distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); | 263 | distance.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); |
264 | distance[0].value = htonl (1); | 264 | distance.value = htonl (1); |
265 | distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
266 | distance[1].value = htonl (0); | ||
267 | 265 | ||
268 | delay = plugin->env->receive (plugin->env->cls, &s->target, message, (const struct GNUNET_TRANSPORT_ATS_Information*) &distance, 2, s, s->addr, s->addrlen); | 266 | delay = plugin->env->receive (plugin->env->cls, &s->target, message, (const struct GNUNET_TRANSPORT_ATS_Information*) &distance, 1, s, s->addr, s->addrlen); |
269 | return delay; | 267 | return delay; |
270 | } | 268 | } |
271 | 269 | ||
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 20e4bda50..d85d5fc82 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1663,13 +1663,10 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1663 | struct GNUNET_TIME_Relative delay; | 1663 | struct GNUNET_TIME_Relative delay; |
1664 | struct GNUNET_TRANSPORT_ATS_Information ats; | 1664 | struct GNUNET_TRANSPORT_ATS_Information ats; |
1665 | 1665 | ||
1666 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
1667 | ats.value = htonl (0); | ||
1668 | |||
1669 | session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; | 1666 | session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; |
1670 | delay = | 1667 | delay = |
1671 | session->plugin->env->receive (session->plugin->env->cls, | 1668 | session->plugin->env->receive (session->plugin->env->cls, |
1672 | &session->target, NULL, &ats, 1, session, | 1669 | &session->target, NULL, &ats, 0, session, |
1673 | NULL, 0); | 1670 | NULL, 0); |
1674 | if (delay.rel_value == 0) | 1671 | if (delay.rel_value == 0) |
1675 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); | 1672 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); |
@@ -1721,16 +1718,14 @@ handle_tcp_data (void *cls, struct GNUNET_SERVER_Client *client, | |||
1721 | GNUNET_STATISTICS_update (plugin->env->stats, | 1718 | GNUNET_STATISTICS_update (plugin->env->stats, |
1722 | gettext_noop ("# bytes received via TCP"), | 1719 | gettext_noop ("# bytes received via TCP"), |
1723 | ntohs (message->size), GNUNET_NO); | 1720 | ntohs (message->size), GNUNET_NO); |
1724 | struct GNUNET_TRANSPORT_ATS_Information distance[2]; | 1721 | struct GNUNET_TRANSPORT_ATS_Information distance; |
1725 | 1722 | ||
1726 | distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); | 1723 | distance.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); |
1727 | distance[0].value = htonl (1); | 1724 | distance.value = htonl (1); |
1728 | distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
1729 | distance[1].value = htonl (0); | ||
1730 | delay = | 1725 | delay = |
1731 | plugin->env->receive (plugin->env->cls, &session->target, message, | 1726 | plugin->env->receive (plugin->env->cls, &session->target, message, |
1732 | (const struct GNUNET_TRANSPORT_ATS_Information *) | 1727 | (const struct GNUNET_TRANSPORT_ATS_Information *) |
1733 | &distance, 2, session, | 1728 | &distance, 1, session, |
1734 | (GNUNET_YES == | 1729 | (GNUNET_YES == |
1735 | session->inbound) ? NULL : session->connect_addr, | 1730 | session->inbound) ? NULL : session->connect_addr, |
1736 | (GNUNET_YES == | 1731 | (GNUNET_YES == |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index adb9277c4..0b37b9be4 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -759,17 +759,15 @@ process_inbound_tokenized_messages (void *cls, void *client, | |||
759 | { | 759 | { |
760 | struct Plugin *plugin = cls; | 760 | struct Plugin *plugin = cls; |
761 | struct SourceInformation *si = client; | 761 | struct SourceInformation *si = client; |
762 | struct GNUNET_TRANSPORT_ATS_Information distance[2]; | 762 | struct GNUNET_TRANSPORT_ATS_Information distance; |
763 | 763 | ||
764 | /* setup ATS */ | 764 | /* setup ATS */ |
765 | distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); | 765 | distance.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); |
766 | distance[0].value = htonl (1); | 766 | distance.value = htonl (1); |
767 | distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
768 | distance[1].value = htonl (0); | ||
769 | 767 | ||
770 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 768 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
771 | "Giving Session %X %s to transport\n", si->session, GNUNET_i2s(&si->session->target)); | 769 | "Giving Session %X %s to transport\n", si->session, GNUNET_i2s(&si->session->target)); |
772 | plugin->env->receive (plugin->env->cls, &si->sender, hdr, distance, 2, si->session, | 770 | plugin->env->receive (plugin->env->cls, &si->sender, hdr, &distance, 1, si->session, |
773 | si->arg, si->args); | 771 | si->arg, si->args); |
774 | } | 772 | } |
775 | 773 | ||
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index da08c5a24..14034e683 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -719,12 +719,10 @@ unix_demultiplexer (struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, | |||
719 | const struct GNUNET_MessageHeader *currhdr, | 719 | const struct GNUNET_MessageHeader *currhdr, |
720 | const struct sockaddr_un *un, size_t fromlen) | 720 | const struct sockaddr_un *un, size_t fromlen) |
721 | { | 721 | { |
722 | struct GNUNET_TRANSPORT_ATS_Information distance[2]; | 722 | struct GNUNET_TRANSPORT_ATS_Information distance; |
723 | 723 | ||
724 | distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); | 724 | distance.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); |
725 | distance[0].value = htonl (UNIX_DIRECT_DISTANCE); | 725 | distance.value = htonl (UNIX_DIRECT_DISTANCE); |
726 | distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
727 | distance[1].value = htonl (0); | ||
728 | 726 | ||
729 | GNUNET_assert (fromlen >= sizeof (struct sockaddr_un)); | 727 | GNUNET_assert (fromlen >= sizeof (struct sockaddr_un)); |
730 | 728 | ||
@@ -734,7 +732,7 @@ unix_demultiplexer (struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, | |||
734 | #endif | 732 | #endif |
735 | plugin->env->receive (plugin->env->cls, sender, currhdr, | 733 | plugin->env->receive (plugin->env->cls, sender, currhdr, |
736 | (const struct GNUNET_TRANSPORT_ATS_Information *) | 734 | (const struct GNUNET_TRANSPORT_ATS_Information *) |
737 | &distance, 2, NULL, un->sun_path, | 735 | &distance, 1, NULL, un->sun_path, |
738 | strlen (un->sun_path) + 1); | 736 | strlen (un->sun_path) + 1); |
739 | } | 737 | } |
740 | 738 | ||
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index dbc3e5493..51da7ec32 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -2334,12 +2334,10 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
2334 | struct Session *session = (struct Session *) client; | 2334 | struct Session *session = (struct Session *) client; |
2335 | struct Plugin *plugin = (struct Plugin *) cls; | 2335 | struct Plugin *plugin = (struct Plugin *) cls; |
2336 | 2336 | ||
2337 | struct GNUNET_TRANSPORT_ATS_Information distance[2]; | 2337 | struct GNUNET_TRANSPORT_ATS_Information distance; |
2338 | 2338 | ||
2339 | distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); | 2339 | distance.type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE); |
2340 | distance[0].value = htonl (1); | 2340 | distance.value = htonl (1); |
2341 | distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
2342 | distance[1].value = htonl (0); | ||
2343 | 2341 | ||
2344 | #if DEBUG_wlan | 2342 | #if DEBUG_wlan |
2345 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, | 2343 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, |
@@ -2352,7 +2350,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
2352 | 2350 | ||
2353 | plugin->env->receive (plugin->env->cls, &(session->target), hdr, | 2351 | plugin->env->receive (plugin->env->cls, &(session->target), hdr, |
2354 | (const struct GNUNET_TRANSPORT_ATS_Information *) | 2352 | (const struct GNUNET_TRANSPORT_ATS_Information *) |
2355 | &distance, 2, session, | 2353 | &distance, 1, session, |
2356 | (const char *) &session->mac->addr, | 2354 | (const char *) &session->mac->addr, |
2357 | sizeof (session->mac->addr)); | 2355 | sizeof (session->mac->addr)); |
2358 | } | 2356 | } |