fix trunk build and tests build without exceptions

This commit is contained in:
Arvid Norberg 2009-12-16 10:42:34 +00:00
parent 96cedc9b5f
commit 2055426c52
7 changed files with 54 additions and 21 deletions

View File

@ -592,9 +592,9 @@ namespace aux {
save_struct(e["settings"], &m_settings, session_settings_map
, sizeof(session_settings_map)/sizeof(session_settings_map[0]));
#ifndef TORRENT_DISABLE_DHT
save_struct(e["dht"], &dht_settings(), dht_settings_map
save_struct(e["dht"], &m_dht_settings, dht_settings_map
, sizeof(dht_settings_map)/sizeof(dht_settings_map[0]));
save_struct(e["dht proxy"], &dht_proxy(), proxy_settings_map
save_struct(e["dht proxy"], &m_dht_proxy, proxy_settings_map
, sizeof(proxy_settings_map)/sizeof(proxy_settings_map[0]));
#endif
#if TORRENT_USE_I2P
@ -602,15 +602,15 @@ namespace aux {
, sizeof(proxy_settings_map)/sizeof(proxy_settings_map[0]));
#endif
#ifndef TORRENT_DISABLE_ENCRYPTION
save_struct(e["encryption"], &get_pe_settings(), pe_settings_map
save_struct(e["encryption"], &m_pe_settings, pe_settings_map
, sizeof(pe_settings_map)/sizeof(pe_settings_map[0]));
#endif
save_struct(e["peer proxy"], &peer_proxy(), proxy_settings_map
save_struct(e["peer proxy"], &m_peer_proxy, proxy_settings_map
, sizeof(proxy_settings_map)/sizeof(proxy_settings_map[0]));
save_struct(e["web proxy"], &web_seed_proxy(), proxy_settings_map
save_struct(e["web proxy"], &m_web_seed_proxy, proxy_settings_map
, sizeof(proxy_settings_map)/sizeof(proxy_settings_map[0]));
save_struct(e["tracker proxy"], &tracker_proxy(), proxy_settings_map
save_struct(e["tracker proxy"], &m_tracker_proxy, proxy_settings_map
, sizeof(proxy_settings_map)/sizeof(proxy_settings_map[0]));
}

View File

@ -85,7 +85,7 @@ bool print_alerts(libtorrent::session& ses, char const* name
&& a->message() != "block finished"
&& a->message() != "piece finished")
{
fprintf(stderr, "%s: %s\n", name, p->message().c_str());
fprintf(stderr, "%s: %s\n", name, a->message().c_str());
}
TEST_CHECK(dynamic_cast<fastresume_rejected_alert*>(a.get()) == 0 || allow_failed_fastresume);

View File

@ -163,13 +163,15 @@ void test_reject_fast()
sha1_hash ih = t->info_hash();
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0);
error_code ec;
ses1.add_torrent(t, "./tmp1_fast", ec);
add_torrent_params p;
p.ti = t;
p.save_path = "./tmp1_fast";
ses1.add_torrent(p, ec);
test_sleep(2000);
io_service ios;
stream_socket s(ios);
error_code ec;
s.connect(tcp::endpoint(address::from_string("127.0.0.1", ec), ses1.listen_port()), ec);
char recv_buffer[1000];
@ -220,8 +222,12 @@ void test_respect_suggest()
boost::intrusive_ptr<torrent_info> t = ::create_torrent();
sha1_hash ih = t->info_hash();
session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48900, 49000), "0.0.0.0", 0);
error_code ec;
ses1.add_torrent(t, "./tmp1_fast", ec);
add_torrent_params p;
p.ti = t;
p.save_path = "./tmp1_fast";
ses1.add_torrent(p, ec);
test_sleep(2000);

View File

@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/socket_io.hpp" // print_endpoint
#include "libtorrent/connection_queue.hpp"
#include "libtorrent/http_connection.hpp"
#include "setup_transfer.hpp"

View File

@ -735,9 +735,13 @@ void test_fastresume(std::string const& test_path)
ses.set_alert_mask(alert::all_categories);
error_code ec;
torrent_handle h = ses.add_torrent(boost::intrusive_ptr<torrent_info>(new torrent_info(*t), ec)
, combine_path(test_path, "tmp1"), entry(), storage_mode_compact);
add_torrent_params p;
p.ti = new torrent_info(*t);
p.save_path = combine_path(test_path, "tmp1");
p.storage_mode = storage_mode_compact;
torrent_handle h = ses.add_torrent(p, ec);
for (int i = 0; i < 10; ++i)
{
print_alerts(ses, "ses");
@ -761,8 +765,15 @@ void test_fastresume(std::string const& test_path)
{
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(t, combine_path(test_path, "tmp1"), resume
, storage_mode_compact);
add_torrent_params p;
p.ti = new torrent_info(*t);
p.save_path = combine_path(test_path, "tmp1");
p.storage_mode = storage_mode_compact;
std::vector<char> resume_buf;
bencode(std::back_inserter(resume_buf), resume);
p.resume_data = &resume_buf;
torrent_handle h = ses.add_torrent(p, ec);
std::auto_ptr<alert> a = ses.pop_alert();
ptime end = time_now() + seconds(20);
@ -807,9 +818,12 @@ void test_rename_file_in_fastresume(std::string const& test_path)
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(boost::intrusive_ptr<torrent_info>(new torrent_info(*t, ec))
, combine_path(test_path, "tmp2"), entry()
, storage_mode_compact);
add_torrent_params p;
p.ti = new torrent_info(*t);
p.save_path = combine_path(test_path, "tmp2");
p.storage_mode = storage_mode_compact;
torrent_handle h = ses.add_torrent(p, ec);
h.rename_file(0, "testing_renamed_files");
std::cout << "renaming file" << std::endl;
@ -838,9 +852,16 @@ void test_rename_file_in_fastresume(std::string const& test_path)
{
session ses(fingerprint(" ", 0,0,0,0), 0);
ses.set_alert_mask(alert::all_categories);
torrent_handle h = ses.add_torrent(t, combine_path(test_path, "tmp2"), resume
, storage_mode_compact);
add_torrent_params p;
p.ti = new torrent_info(*t);
p.save_path = combine_path(test_path, "tmp2");
p.storage_mode = storage_mode_compact;
std::vector<char> resume_buf;
bencode(std::back_inserter(resume_buf), resume);
p.resume_data = &resume_buf;
torrent_handle h = ses.add_torrent(p, ec);
for (int i = 0; i < 5; ++i)
{
print_alerts(ses, "ses");

View File

@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/upnp.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/socket_io.hpp" // print_endpoint
#include "libtorrent/connection_queue.hpp"
#include "test.hpp"
#include "setup_transfer.hpp"

View File

@ -78,7 +78,11 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file, int proxy)
ses.set_web_seed_proxy(ps);
}
torrent_handle th = ses.add_torrent(*torrent_file, "./tmp2_web_seed", ec);
add_torrent_params p;
p.ti = torrent_file;
p.save_path = "./tmp2_web_seed";
p.storage_mode = storage_mode_compact;
torrent_handle th = ses.add_torrent(p, ec);
std::vector<announce_entry> empty;
th.replace_trackers(empty);