diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index c778b97f6..6556bb17c 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include @@ -488,6 +490,18 @@ namespace return ret; } + void load_state(session& ses, entry const& st) + { + allow_threading_guard guard; + + std::vector 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 @@ -500,11 +514,6 @@ void bind_session() #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") .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_country_db", &load_country_db) #endif - .def("load_state", load_state0) + .def("load_state", &load_state) .def("save_state", &save_state, (arg("entry"), arg("flags") = 0xffffffff)) #ifndef TORRENT_NO_DEPRECATE - .def("load_state", load_state1) .def("set_severity_level", allow_threads(&session::set_severity_level)) .def("set_alert_queue_size_limit", allow_threads(&session::set_alert_queue_size_limit)) #endif diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index 40dc656d4..f0b2e195b 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -136,10 +136,6 @@ namespace 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) { std::vector p = ti.map_block(piece, offset, size); @@ -214,8 +210,8 @@ void bind_torrent_info() .def("total_size", &torrent_info::total_size) .def("piece_length", &torrent_info::piece_length) .def("num_pieces", &torrent_info::num_pieces) -#ifndef TORRENT_NO_DEPRECATE .def("info_hash", &torrent_info::info_hash, copy) +#ifndef TORRENT_NO_DEPRECATE .def("file_at_offset", &torrent_info::file_at_offset) #endif .def("hash_for_piece", &hash_for_piece)