mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Fix setting outgoing ports
This commit is contained in:
parent
7376a1e125
commit
d268ed4955
6 changed files with 57 additions and 3 deletions
|
@ -2,6 +2,7 @@ Deluge 1.1.1 - (In Development)
|
||||||
Core:
|
Core:
|
||||||
* Fix oldstateupgrader for those upgrading from 0.5.x
|
* Fix oldstateupgrader for those upgrading from 0.5.x
|
||||||
* Fix setting Peer TOS byte
|
* Fix setting Peer TOS byte
|
||||||
|
* Fix setting outgoing ports
|
||||||
|
|
||||||
GtkUI:
|
GtkUI:
|
||||||
* Fix opening links from Help menu and others
|
* Fix opening links from Help menu and others
|
||||||
|
|
|
@ -256,7 +256,8 @@ class PreferencesManager(component.Component):
|
||||||
def _on_set_outgoing_ports(self, key, value):
|
def _on_set_outgoing_ports(self, key, value):
|
||||||
if not self.config["random_outgoing_ports"]:
|
if not self.config["random_outgoing_ports"]:
|
||||||
log.debug("outgoing port range set to %s-%s", value[0], value[1])
|
log.debug("outgoing port range set to %s-%s", value[0], value[1])
|
||||||
self.session.outgoing_ports(value[0], value[1])
|
self.settings.outgoing_ports = value[0], value[1]
|
||||||
|
self.session.set_settings(self.settings)
|
||||||
|
|
||||||
def _on_set_random_outgoing_ports(self, key, value):
|
def _on_set_random_outgoing_ports(self, key, value):
|
||||||
if value:
|
if value:
|
||||||
|
|
|
@ -1,5 +1,51 @@
|
||||||
// Copyright Daniel Wallin 2007. Use, modification and distribution is
|
// Copyright Andrew Resch 2009. Use, modification and distribution is
|
||||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#include <boost/python.hpp>
|
||||||
|
|
||||||
|
using namespace boost::python;
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct pair_to_tuple
|
||||||
|
{
|
||||||
|
static PyObject* convert(const std::pair<T1, T2>& p)
|
||||||
|
{
|
||||||
|
return incref(make_tuple(p.first, p.second).ptr());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct tuple_to_pair
|
||||||
|
{
|
||||||
|
tuple_to_pair()
|
||||||
|
{
|
||||||
|
converter::registry::push_back(
|
||||||
|
&convertible, &construct, type_id<std::pair<T1, T2> >()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* convertible(PyObject* x)
|
||||||
|
{
|
||||||
|
return PyTuple_Check(x) ? x: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void construct(PyObject* x, converter::rvalue_from_python_stage1_data* data)
|
||||||
|
{
|
||||||
|
void* storage = ((converter::rvalue_from_python_storage<
|
||||||
|
std::pair<T1, T2> >*)data)->storage.bytes;
|
||||||
|
|
||||||
|
object o(borrowed(x));
|
||||||
|
std::pair<T1, T2> p;
|
||||||
|
p.first = extract<T1>(o[0]);
|
||||||
|
p.second = extract<T2>(o[1]);
|
||||||
|
new (storage) std::pair<T1, T2>(p);
|
||||||
|
data->convertible = storage;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void bind_converters()
|
||||||
|
{
|
||||||
|
to_python_converter<std::pair<int, int>, pair_to_tuple<int, int> >();
|
||||||
|
tuple_to_pair<int, int>();
|
||||||
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ void bind_torrent();
|
||||||
void bind_peer_info();
|
void bind_peer_info();
|
||||||
void bind_ip_filter();
|
void bind_ip_filter();
|
||||||
void bind_magnet_uri();
|
void bind_magnet_uri();
|
||||||
|
void bind_converters();
|
||||||
|
|
||||||
BOOST_PYTHON_MODULE(libtorrent)
|
BOOST_PYTHON_MODULE(libtorrent)
|
||||||
{
|
{
|
||||||
|
@ -48,5 +49,5 @@ BOOST_PYTHON_MODULE(libtorrent)
|
||||||
bind_peer_info();
|
bind_peer_info();
|
||||||
bind_ip_filter();
|
bind_ip_filter();
|
||||||
bind_magnet_uri();
|
bind_magnet_uri();
|
||||||
|
bind_converters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,6 +300,7 @@ void bind_session()
|
||||||
.def("stop_dht", allow_threads(&session::stop_dht), session_stop_dht_doc)
|
.def("stop_dht", allow_threads(&session::stop_dht), session_stop_dht_doc)
|
||||||
.def("dht_state", allow_threads(&session::dht_state), session_dht_state_doc)
|
.def("dht_state", allow_threads(&session::dht_state), session_dht_state_doc)
|
||||||
.def("set_dht_proxy", allow_threads(&session::set_dht_proxy))
|
.def("set_dht_proxy", allow_threads(&session::set_dht_proxy))
|
||||||
|
.def("dht_proxy", allow_threads(&session::dht_proxy), return_value_policy<copy_const_reference>())
|
||||||
#endif
|
#endif
|
||||||
.def("add_torrent", &add_torrent, session_add_torrent_doc)
|
.def("add_torrent", &add_torrent, session_add_torrent_doc)
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
@ -373,6 +374,9 @@ void bind_session()
|
||||||
.def("set_peer_proxy", allow_threads(&session::set_peer_proxy))
|
.def("set_peer_proxy", allow_threads(&session::set_peer_proxy))
|
||||||
.def("set_tracker_proxy", allow_threads(&session::set_tracker_proxy))
|
.def("set_tracker_proxy", allow_threads(&session::set_tracker_proxy))
|
||||||
.def("set_web_seed_proxy", allow_threads(&session::set_web_seed_proxy))
|
.def("set_web_seed_proxy", allow_threads(&session::set_web_seed_proxy))
|
||||||
|
.def("peer_proxy", allow_threads(&session::peer_proxy), return_value_policy<copy_const_reference>())
|
||||||
|
.def("tracker_proxy", allow_threads(&session::tracker_proxy), return_value_policy<copy_const_reference>())
|
||||||
|
.def("web_seed_proxy", allow_threads(&session::web_seed_proxy), return_value_policy<copy_const_reference>())
|
||||||
.def("start_upnp", &start_upnp, session_start_upnp_doc)
|
.def("start_upnp", &start_upnp, session_start_upnp_doc)
|
||||||
.def("stop_upnp", allow_threads(&session::stop_upnp), session_stop_upnp_doc)
|
.def("stop_upnp", allow_threads(&session::stop_upnp), session_stop_upnp_doc)
|
||||||
.def("start_lsd", allow_threads(&session::start_lsd), session_start_lsd_doc)
|
.def("start_lsd", allow_threads(&session::start_lsd), session_start_lsd_doc)
|
||||||
|
|
|
@ -45,6 +45,7 @@ void bind_session_settings()
|
||||||
.def_readwrite("auto_scraped_interval", &session_settings::auto_scrape_interval)
|
.def_readwrite("auto_scraped_interval", &session_settings::auto_scrape_interval)
|
||||||
.def_readwrite("peer_tos", &session_settings::peer_tos)
|
.def_readwrite("peer_tos", &session_settings::peer_tos)
|
||||||
.def_readwrite("rate_limit_ip_overhead", &session_settings::rate_limit_ip_overhead)
|
.def_readwrite("rate_limit_ip_overhead", &session_settings::rate_limit_ip_overhead)
|
||||||
|
.def_readwrite("outgoing_ports", &session_settings::outgoing_ports)
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
.def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback)
|
.def_readwrite("use_dht_as_fallback", &session_settings::use_dht_as_fallback)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue