forked from premiere/premiere-libtorrent
merged python binding fix from RC_0_16
This commit is contained in:
parent
8eece6b704
commit
9395186a7d
|
@ -12,6 +12,8 @@
|
||||||
#include <libtorrent/ip_filter.hpp>
|
#include <libtorrent/ip_filter.hpp>
|
||||||
#include <libtorrent/disk_io_thread.hpp>
|
#include <libtorrent/disk_io_thread.hpp>
|
||||||
#include <libtorrent/extensions.hpp>
|
#include <libtorrent/extensions.hpp>
|
||||||
|
#include <libtorrent/lazy_entry.hpp>
|
||||||
|
#include <libtorrent/bencode.hpp>
|
||||||
|
|
||||||
#include <libtorrent/extensions/lt_trackers.hpp>
|
#include <libtorrent/extensions/lt_trackers.hpp>
|
||||||
#include <libtorrent/extensions/metadata_transfer.hpp>
|
#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||||
|
@ -488,6 +490,18 @@ namespace
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void load_state(session& ses, entry const& st)
|
||||||
|
{
|
||||||
|
allow_threading_guard guard;
|
||||||
|
|
||||||
|
std::vector<char> buf;
|
||||||
|
bencode(std::back_inserter(buf), st);
|
||||||
|
lazy_entry e;
|
||||||
|
error_code ec;
|
||||||
|
lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
|
||||||
|
TORRENT_ASSERT(!ec);
|
||||||
|
ses.load_state(e);
|
||||||
|
}
|
||||||
} // namespace unnamed
|
} // namespace unnamed
|
||||||
|
|
||||||
|
|
||||||
|
@ -500,11 +514,6 @@ void bind_session()
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void (session::*load_state0)(lazy_entry const&) = &session::load_state;
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
void (session::*load_state1)(entry const&) = &session::load_state;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class_<session_status>("session_status")
|
class_<session_status>("session_status")
|
||||||
.def_readonly("has_incoming_connections", &session_status::has_incoming_connections)
|
.def_readonly("has_incoming_connections", &session_status::has_incoming_connections)
|
||||||
|
|
||||||
|
@ -707,10 +716,9 @@ void bind_session()
|
||||||
.def("load_asnum_db", &load_asnum_db)
|
.def("load_asnum_db", &load_asnum_db)
|
||||||
.def("load_country_db", &load_country_db)
|
.def("load_country_db", &load_country_db)
|
||||||
#endif
|
#endif
|
||||||
.def("load_state", load_state0)
|
.def("load_state", &load_state)
|
||||||
.def("save_state", &save_state, (arg("entry"), arg("flags") = 0xffffffff))
|
.def("save_state", &save_state, (arg("entry"), arg("flags") = 0xffffffff))
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
.def("load_state", load_state1)
|
|
||||||
.def("set_severity_level", allow_threads(&session::set_severity_level))
|
.def("set_severity_level", allow_threads(&session::set_severity_level))
|
||||||
.def("set_alert_queue_size_limit", allow_threads(&session::set_alert_queue_size_limit))
|
.def("set_alert_queue_size_limit", allow_threads(&session::set_alert_queue_size_limit))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -136,10 +136,6 @@ namespace
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent_info construct0(std::string path) {
|
|
||||||
return torrent_info(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
list map_block(torrent_info& ti, int piece, size_type offset, int size)
|
list map_block(torrent_info& ti, int piece, size_type offset, int size)
|
||||||
{
|
{
|
||||||
std::vector<file_slice> p = ti.map_block(piece, offset, size);
|
std::vector<file_slice> p = ti.map_block(piece, offset, size);
|
||||||
|
@ -214,8 +210,8 @@ void bind_torrent_info()
|
||||||
.def("total_size", &torrent_info::total_size)
|
.def("total_size", &torrent_info::total_size)
|
||||||
.def("piece_length", &torrent_info::piece_length)
|
.def("piece_length", &torrent_info::piece_length)
|
||||||
.def("num_pieces", &torrent_info::num_pieces)
|
.def("num_pieces", &torrent_info::num_pieces)
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
.def("info_hash", &torrent_info::info_hash, copy)
|
.def("info_hash", &torrent_info::info_hash, copy)
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
.def("file_at_offset", &torrent_info::file_at_offset)
|
.def("file_at_offset", &torrent_info::file_at_offset)
|
||||||
#endif
|
#endif
|
||||||
.def("hash_for_piece", &hash_for_piece)
|
.def("hash_for_piece", &hash_for_piece)
|
||||||
|
|
Loading…
Reference in New Issue