From 1c13f828dd3618c6e511a0a4c172a4efd6961ec4 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 7 Mar 2011 08:24:02 +0000 Subject: [PATCH] python binding fixes --- bindings/python/client.py | 6 +++--- bindings/python/src/session.cpp | 14 ++++++++++++++ bindings/python/src/torrent_info.cpp | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bindings/python/client.py b/bindings/python/client.py index ab3c3a2be..ba9c83be3 100755 --- a/bindings/python/client.py +++ b/bindings/python/client.py @@ -226,9 +226,9 @@ def main(): ses.set_settings(settings) # ses.set_severity_level(lt.alert.severity_levels.info) ses.set_alert_mask(0xfffffff) - ses.add_extension(lt.create_ut_pex_plugin) - ses.add_extension(lt.create_ut_metadata_plugin) - ses.add_extension(lt.create_metadata_plugin) +# ses.add_extension(lt.create_ut_pex_plugin) +# ses.add_extension(lt.create_ut_metadata_plugin) +# ses.add_extension(lt.create_metadata_plugin) handles = [] alerts = [] diff --git a/bindings/python/src/session.cpp b/bindings/python/src/session.cpp index d9bb8e5e2..1861928d8 100644 --- a/bindings/python/src/session.cpp +++ b/bindings/python/src/session.cpp @@ -97,6 +97,8 @@ namespace dict session_get_settings(session const& ses) { + allow_threading_guard guard; + session_settings sett = ses.settings(); dict sett_dict; bencode_map_entry* map; @@ -196,6 +198,8 @@ namespace add_torrent_params p; dict_to_add_torrent_params(params, p); + allow_threading_guard guard; + #ifndef BOOST_NO_EXCEPTIONS return s.add_torrent(p); #else @@ -218,6 +222,8 @@ namespace feed_handle add_feed(session& s, dict params) { + allow_threading_guard guard; + feed_settings feed; dict_to_feed_settings(params, feed); @@ -226,6 +232,8 @@ namespace dict get_feed_status(feed_handle const& h) { + allow_threading_guard guard; + feed_status s = h.get_feed_status(); dict ret; ret["url"] = s.url; @@ -259,6 +267,8 @@ namespace void set_feed_settings(feed_handle& h, dict sett) { + allow_threading_guard guard; + feed_settings feed; dict_to_feed_settings(sett, feed); h.set_settings(feed); @@ -266,6 +276,8 @@ namespace dict get_feed_settings(feed_handle& h) { + allow_threading_guard guard; + feed_settings s = h.settings(); dict ret; ret["url"] = s.url; @@ -294,6 +306,7 @@ namespace list get_torrents(session& s) { + allow_threading_guard guard; list ret; std::vector torrents = s.get_torrents(); @@ -320,6 +333,7 @@ namespace entry save_state(session const& s, boost::uint32_t flags) { + allow_threading_guard guard; entry e; s.save_state(e, flags); return e; diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index ee56f6ec0..107e9e26c 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -103,9 +103,9 @@ namespace { return ae.send_stats; } - bool get_size(file_entry const& fe) + size_type get_size(file_entry const& fe) { return fe.size; } - bool get_offset(file_entry const& fe) + size_type get_offset(file_entry const& fe) { return fe.offset; } bool get_pad_file(file_entry const& fe) { return fe.pad_file; }