From 4b0c4165d75633af06a30c659aff9fe99ab739e0 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 3 Sep 2013 16:02:24 +0000 Subject: [PATCH] fix tests --- include/libtorrent/proxy_base.hpp | 2 +- include/libtorrent/ssl_stream.hpp | 14 ++++++++++++++ test/setup_transfer.cpp | 2 +- test/test_pe_crypto.cpp | 27 --------------------------- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/include/libtorrent/proxy_base.hpp b/include/libtorrent/proxy_base.hpp index 6bce3b87f..1019ff68a 100644 --- a/include/libtorrent/proxy_base.hpp +++ b/include/libtorrent/proxy_base.hpp @@ -135,7 +135,7 @@ public: #ifndef BOOST_NO_EXCEPTIONS template - void set_option(GettableSocketOption& opt) + void get_option(GettableSocketOption& opt) { m_sock.get_option(opt); } diff --git a/include/libtorrent/ssl_stream.hpp b/include/libtorrent/ssl_stream.hpp index 9cbeaef3d..2582f724a 100644 --- a/include/libtorrent/ssl_stream.hpp +++ b/include/libtorrent/ssl_stream.hpp @@ -146,6 +146,20 @@ public: return m_sock.next_layer().set_option(opt, ec); } +#ifndef BOOST_NO_EXCEPTIONS + template + void get_option(GettableSocketOption& opt) + { + m_sock.get_option(opt); + } +#endif + + template + error_code get_option(GettableSocketOption& opt, error_code& ec) + { + return m_sock.get_option(opt, ec); + } + #ifndef BOOST_NO_EXCEPTIONS template std::size_t read_some(Mutable_Buffers const& buffers) diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index b6f0feaaf..8cc08ad9a 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -189,7 +189,7 @@ bool print_alerts(libtorrent::session& ses, char const* name if (predicate && predicate(*i)) ret = true; if (peer_disconnected_alert* p = alert_cast(*i)) { - fprintf(stderr, "%s: %s(%s): %s\n", time_now_string(), name, print_endpoint(p->ip).c_str(), p->message().c_str()); + fprintf(stderr, "%s: %s [%s] (%s): %s\n", time_now_string(), name, (*i)->what(), print_endpoint(p->ip).c_str(), p->message().c_str()); } else if ((*i)->message() != "block downloading" && (*i)->message() != "block finished" diff --git a/test/test_pe_crypto.cpp b/test/test_pe_crypto.cpp index 7ebf2a86b..3420dde1b 100644 --- a/test/test_pe_crypto.cpp +++ b/test/test_pe_crypto.cpp @@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/hasher.hpp" #include "libtorrent/pe_crypto.hpp" #include "libtorrent/session.hpp" -#include "libtorrent/rsa.hpp" #include "setup_transfer.hpp" #include "test.hpp" @@ -215,32 +214,6 @@ int test_main() fprintf(stderr, "PE test not run because it's disabled\n"); #endif -#if defined TORRENT_USE_OPENSSL - // test sign_rsa and verify_rsa - char private_key[1192]; - int private_len = sizeof(private_key); - char public_key[268]; - int public_len = sizeof(public_key); - - int ret = generate_rsa_keys(public_key, &public_len, private_key, &private_len, 2048); - fprintf(stderr, "keysizes: pub: %d priv: %d\n", public_len, private_len); - - TEST_CHECK(ret); - - char test_message[1024]; - std::generate(test_message, test_message + 1024, &std::rand); - - char signature[256]; - int sig_len = sign_rsa(hasher(test_message, sizeof(test_message)).final() - , private_key, private_len, signature, sizeof(signature)); - - TEST_CHECK(sig_len == 256); - - ret = verify_rsa(hasher(test_message, sizeof(test_message)).final() - , public_key, public_len, signature, sig_len); - TEST_CHECK(ret == 1); -#endif - return 0; }