diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-07 11:42:10 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-07 11:42:10 +0000 |
commit | 8df584aafe56a0ab901c780e5405feb273e09475 (patch) | |
tree | 6b3063a56e52db463d16d35f924ec7f5c05a8d4a /src/transport/gnunet-service-transport_validation.c | |
parent | fb86f460db5664b66478b6d025ed691352ce67d8 (diff) | |
download | gnunet-8df584aafe56a0ab901c780e5405feb273e09475.tar.gz gnunet-8df584aafe56a0ab901c780e5405feb273e09475.zip |
correct usage of ats \0 termination
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index cbf0bc7d2..395f4e87a 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -408,8 +408,12 @@ add_valid_address (void *cls, const char *tname, | |||
408 | } | 408 | } |
409 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); | 409 | ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen); |
410 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); | 410 | ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until, expiration); |
411 | struct GNUNET_TRANSPORT_ATS_Information ats; | ||
412 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
413 | ats.value = htonl (0); | ||
414 | |||
411 | GNUNET_ATS_address_update (GST_ats, &pid, ve->valid_until, tname, NULL, addr, | 415 | GNUNET_ATS_address_update (GST_ats, &pid, ve->valid_until, tname, NULL, addr, |
412 | addrlen, NULL, 0); | 416 | addrlen, &ats, 1); |
413 | return GNUNET_OK; | 417 | return GNUNET_OK; |
414 | } | 418 | } |
415 | 419 | ||
@@ -774,10 +778,13 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid, | |||
774 | if (papi == NULL) | 778 | if (papi == NULL) |
775 | ret = -1; | 779 | ret = -1; |
776 | else | 780 | else |
781 | { | ||
782 | GNUNET_assert (papi->send != NULL); | ||
777 | ret = | 783 | ret = |
778 | papi->send (papi->cls, pid, message_buf, tsize, PING_PRIORITY, | 784 | papi->send (papi->cls, pid, message_buf, tsize, PING_PRIORITY, |
779 | HELLO_REVALIDATION_START_TIME, NULL /* no session */ , | 785 | HELLO_REVALIDATION_START_TIME, NULL /* no session */ , |
780 | ve->addr, ve->addrlen, GNUNET_YES, NULL, NULL); | 786 | ve->addr, ve->addrlen, GNUNET_YES, NULL, NULL); |
787 | } | ||
781 | } | 788 | } |
782 | if (-1 != ret) | 789 | if (-1 != ret) |
783 | { | 790 | { |
@@ -911,6 +918,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
911 | 918 | ||
912 | if (ntohs (hdr->size) < sizeof (struct TransportPongMessage)) | 919 | if (ntohs (hdr->size) < sizeof (struct TransportPongMessage)) |
913 | { | 920 | { |
921 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "SIZE!\n"); | ||
914 | GNUNET_break_op (0); | 922 | GNUNET_break_op (0); |
915 | return; | 923 | return; |
916 | } | 924 | } |
@@ -965,8 +973,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
965 | GNUNET_break_op (0); | 973 | GNUNET_break_op (0); |
966 | return; | 974 | return; |
967 | } | 975 | } |
968 | 976 | #if DEBUG_TRANSPORT | |
969 | #if VERBOSE_VALIDATION | ||
970 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 977 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
971 | "Address validated for peer `%s' with plugin `%s': `%s'\n", | 978 | "Address validated for peer `%s' with plugin `%s': `%s'\n", |
972 | GNUNET_i2s (sender), tname, GST_plugins_a2s (tname, addr, | 979 | GNUNET_i2s (sender), tname, GST_plugins_a2s (tname, addr, |
@@ -975,7 +982,10 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, | |||
975 | 982 | ||
976 | /* validity achieved, remember it! */ | 983 | /* validity achieved, remember it! */ |
977 | ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); | 984 | ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION); |
978 | GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, NULL, 0); /* FIXME: compute and add latency here... */ | 985 | struct GNUNET_TRANSPORT_ATS_Information ats; |
986 | ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | ||
987 | ats.value = htonl (0); | ||
988 | GNUNET_ATS_address_update (GST_ats, &ve->pid, ve->valid_until, ve->transport_name, NULL, ve->addr, ve->addrlen, &ats, 1); /* FIXME: compute and add latency here... */ | ||
979 | 989 | ||
980 | /* build HELLO to store in PEERINFO */ | 990 | /* build HELLO to store in PEERINFO */ |
981 | ve->copied = GNUNET_NO; | 991 | ve->copied = GNUNET_NO; |