asserts and logging in SSL test

This commit is contained in:
Arvid Norberg
2014-01-17 01:00:49 +00:00
parent 130b2fb25c
commit 36889a1524
3 changed files with 9 additions and 2 deletions

View File

@@ -65,8 +65,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_CFG \ #define TORRENT_CFG \
BOOST_PP_CAT(TORRENT_CFG_TIME, \ BOOST_PP_CAT(TORRENT_CFG_TIME, \
BOOST_PP_CAT(TORRENT_CFG_LOG, \ TORRENT_CFG_DEPR)
TORRENT_CFG_DEPR))
#define TORRENT_CFG_STRING BOOST_PP_STRINGIZE(TORRENT_CFG) #define TORRENT_CFG_STRING BOOST_PP_STRINGIZE(TORRENT_CFG)

View File

@@ -106,6 +106,8 @@ namespace libtorrent
m_waiting_to_shutdown = true; m_waiting_to_shutdown = true;
j.action = disk_io_job::abort_thread; j.action = disk_io_job::abort_thread;
j.start_time = time_now_hires(); j.start_time = time_now_hires();
TORRENT_ASSERT(l.locked());
m_jobs.insert(m_jobs.begin(), j); m_jobs.insert(m_jobs.begin(), j);
m_signal.signal(l); m_signal.signal(l);
} }
@@ -1357,6 +1359,7 @@ namespace libtorrent
const_cast<disk_io_job&>(j).buffer = 0; const_cast<disk_io_job&>(j).buffer = 0;
} }
*/ */
TORRENT_ASSERT(l.locked());
m_jobs.push_back(j); m_jobs.push_back(j);
m_jobs.back().callback.swap(const_cast<boost::function<void(int, disk_io_job const&)>&>(f)); m_jobs.back().callback.swap(const_cast<boost::function<void(int, disk_io_job const&)>&>(f));

View File

@@ -375,6 +375,7 @@ bool try_connect(session& ses1, int port
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_sock(ios, ctx); boost::asio::ssl::stream<boost::asio::ip::tcp::socket> ssl_sock(ios, ctx);
fprintf(stderr, "connecting\n");
ssl_sock.lowest_layer().connect(tcp::endpoint( ssl_sock.lowest_layer().connect(tcp::endpoint(
address_v4::from_string("127.0.0.1"), port), ec); address_v4::from_string("127.0.0.1"), port), ec);
print_alerts(ses1, "ses1", true, true, true, &on_alert); print_alerts(ses1, "ses1", true, true, true, &on_alert);
@@ -405,6 +406,7 @@ bool try_connect(session& ses1, int port
SSL_set_tlsext_host_name(ssl_sock.native_handle(), name.c_str()); SSL_set_tlsext_host_name(ssl_sock.native_handle(), name.c_str());
} }
fprintf(stderr, "SSL handshake\n");
ssl_sock.handshake(asio::ssl::stream_base::client, ec); ssl_sock.handshake(asio::ssl::stream_base::client, ec);
print_alerts(ses1, "ses1", true, true, true, &on_alert); print_alerts(ses1, "ses1", true, true, true, &on_alert);
@@ -434,6 +436,8 @@ bool try_connect(session& ses1, int port
// fill in the peer-id // fill in the peer-id
std::generate(handshake + 48, handshake + 68, &rand); std::generate(handshake + 48, handshake + 68, &rand);
fprintf(stderr, "bittorrent handshake\n");
boost::asio::write(ssl_sock, libtorrent::asio::buffer(handshake, (sizeof(handshake) - 1)), ec); boost::asio::write(ssl_sock, libtorrent::asio::buffer(handshake, (sizeof(handshake) - 1)), ec);
if (ec) if (ec)
{ {
@@ -443,6 +447,7 @@ bool try_connect(session& ses1, int port
} }
char buf[68]; char buf[68];
fprintf(stderr, "read bittorrent handshake\n");
boost::asio::read(ssl_sock, libtorrent::asio::buffer(buf, sizeof(buf)), ec); boost::asio::read(ssl_sock, libtorrent::asio::buffer(buf, sizeof(buf)), ec);
if (ec) if (ec)
{ {