mirror of
https://github.com/arvidn/libtorrent.git
synced 2026-05-08 00:39:53 -04:00
the session constructor taking a settings_pack directly was deprecated, but this is still the only way to construct a session via the python bindings. session_params does not have a python binding (yet). When updating the python binding, there was an incorrect assumption that the session would be constructed via an implicitly created session_params object (which would happen if deprecated functions was disabled). However, when the session is constructed with the deprecated settings_pack, the flags actually matter for adding default plugins. The python binding could be improved in this regard, ideally to better match the C++ API by having a session_params object
This commit is contained in:
committed by
Arvid Norberg
parent
12ec9ee162
commit
634497af0e
@@ -1,3 +1,4 @@
|
||||
* fix python binding regression in session constructor flags
|
||||
* fix unaligned piece requests in mmap_storage
|
||||
* improve client_data_t ergonomics
|
||||
* fix issue with concurrent access to part files
|
||||
|
||||
@@ -180,7 +180,20 @@ namespace
|
||||
{
|
||||
settings_pack p;
|
||||
make_settings_pack(p, sett);
|
||||
return std::make_shared<lt::session>(p, flags);
|
||||
#if TORRENT_ABI_VERSION <= 2
|
||||
if (flags & lt::session::add_default_plugins)
|
||||
{
|
||||
#endif
|
||||
session_params params(std::move(p));
|
||||
return std::make_shared<lt::session>(std::move(params), flags);
|
||||
#if TORRENT_ABI_VERSION <= 2
|
||||
}
|
||||
else
|
||||
{
|
||||
session_params params(std::move(p), {});
|
||||
return std::make_shared<lt::session>(std::move(params), flags);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void session_apply_settings(lt::session& ses, dict const& sett_dict)
|
||||
@@ -961,9 +974,14 @@ void bind_session()
|
||||
scope s = class_<lt::session, boost::noncopyable>("session", no_init)
|
||||
.def("__init__", boost::python::make_constructor(&make_session
|
||||
, default_call_policies()
|
||||
, (arg("settings"), arg("flags")=lt::session_flags_t{})
|
||||
, (arg("settings"), arg("flags")=
|
||||
#if TORRENT_ABI_VERSION <= 2
|
||||
lt::session::add_default_plugins
|
||||
#else
|
||||
lt::session_flags_t{}
|
||||
#endif
|
||||
))
|
||||
)
|
||||
)
|
||||
#if TORRENT_ABI_VERSION == 1
|
||||
.def(
|
||||
init<fingerprint, session_flags_t, alert_category_t>((
|
||||
|
||||
Reference in New Issue
Block a user