diff options
-rw-r--r-- | src/transport/gnunet-service-transport_validation.c | 68 | ||||
-rw-r--r-- | src/transport/plugin_transport_http.h | 4 |
2 files changed, 56 insertions, 16 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 17fc5edc6..83940d43d 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c | |||
@@ -481,11 +481,24 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid, | |||
481 | else | 481 | else |
482 | { | 482 | { |
483 | GNUNET_assert (papi->send != NULL); | 483 | GNUNET_assert (papi->send != NULL); |
484 | ret = | 484 | GNUNET_assert (papi->get_session != NULL); |
485 | papi->send (papi->cls, pid, message_buf, tsize, PING_PRIORITY, | 485 | struct Session * session = papi->get_session(papi->cls, ve->address); |
486 | ACCEPTABLE_PING_DELAY, NULL /* no session */ , | 486 | |
487 | ve->address->address, ve->address->address_length, | 487 | if (session != NULL) |
488 | GNUNET_YES, NULL, NULL); | 488 | { |
489 | ret = papi->send_with_session (papi->cls, session, | ||
490 | message_buf, tsize, | ||
491 | PING_PRIORITY, ACCEPTABLE_PING_DELAY, | ||
492 | NULL, NULL); | ||
493 | } | ||
494 | else | ||
495 | { | ||
496 | /* Could not get a valid session */ | ||
497 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not get a valid session for `%s' %s\n", | ||
498 | GNUNET_i2s (pid), GST_plugins_a2s (ve->address)); | ||
499 | GNUNET_break (0); | ||
500 | ret = -1; | ||
501 | } | ||
489 | } | 502 | } |
490 | } | 503 | } |
491 | if (-1 != ret) | 504 | if (-1 != ret) |
@@ -727,10 +740,21 @@ multicast_pong (void *cls, | |||
727 | papi = GST_plugins_find (address->transport_name); | 740 | papi = GST_plugins_find (address->transport_name); |
728 | if (papi == NULL) | 741 | if (papi == NULL) |
729 | return; | 742 | return; |
730 | (void) papi->send (papi->cls, &address->peer, (const char *) pong, | 743 | |
731 | ntohs (pong->header.size), PONG_PRIORITY, | 744 | GNUNET_assert (papi->send != NULL); |
732 | ACCEPTABLE_PING_DELAY, NULL, address->address, | 745 | GNUNET_assert (papi->get_session != NULL); |
733 | address->address_length, GNUNET_YES, NULL, NULL); | 746 | |
747 | struct Session * session = papi->get_session(papi->cls, address); | ||
748 | if (session == NULL) | ||
749 | { | ||
750 | GNUNET_break (0); | ||
751 | return; | ||
752 | } | ||
753 | |||
754 | papi->send_with_session (papi->cls, session, | ||
755 | (const char *) pong, ntohs (pong->header.size), | ||
756 | PONG_PRIORITY, ACCEPTABLE_PING_DELAY, | ||
757 | NULL, NULL); | ||
734 | } | 758 | } |
735 | 759 | ||
736 | 760 | ||
@@ -862,11 +886,27 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, | |||
862 | if (papi == NULL) | 886 | if (papi == NULL) |
863 | ret = -1; | 887 | ret = -1; |
864 | else | 888 | else |
865 | ret = | 889 | { |
866 | papi->send (papi->cls, sender, (const char *) pong, | 890 | GNUNET_assert (papi->send != NULL); |
867 | ntohs (pong->header.size), PONG_PRIORITY, | 891 | GNUNET_assert (papi->get_session != NULL); |
868 | ACCEPTABLE_PING_DELAY, session, sender_address->address, | 892 | |
869 | sender_address->address_length, GNUNET_SYSERR, NULL, NULL); | 893 | if ((session == NULL) && (sender_address != NULL)) |
894 | { | ||
895 | session = papi->get_session (papi->cls, sender_address); | ||
896 | } | ||
897 | if (session == NULL) | ||
898 | { | ||
899 | GNUNET_break (0); | ||
900 | ret = -1; | ||
901 | } | ||
902 | else | ||
903 | { | ||
904 | ret = papi->send_with_session (papi->cls, session, | ||
905 | (const char *) pong, ntohs (pong->header.size), | ||
906 | PONG_PRIORITY, ACCEPTABLE_PING_DELAY, | ||
907 | NULL, NULL); | ||
908 | } | ||
909 | } | ||
870 | if (ret != -1) | 910 | if (ret != -1) |
871 | { | 911 | { |
872 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 912 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index 9e16e93c8..be8f93dd2 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h | |||
@@ -42,10 +42,10 @@ | |||
42 | #include <curl/curl.h> | 42 | #include <curl/curl.h> |
43 | 43 | ||
44 | 44 | ||
45 | #define DEBUG_HTTP GNUNET_YES | 45 | #define DEBUG_HTTP GNUNET_EXTRA_LOGGING |
46 | #define VERBOSE_SERVER GNUNET_EXTRA_LOGGING | 46 | #define VERBOSE_SERVER GNUNET_EXTRA_LOGGING |
47 | #define VERBOSE_CLIENT GNUNET_EXTRA_LOGGING | 47 | #define VERBOSE_CLIENT GNUNET_EXTRA_LOGGING |
48 | #define VERBOSE_CURL GNUNET_NO | 48 | #define VERBOSE_CURL GNUNET_EXTRA_LOGGING |
49 | 49 | ||
50 | #if BUILD_HTTPS | 50 | #if BUILD_HTTPS |
51 | #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init | 51 | #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init |