mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-04 15:43:28 +00:00
separate add rule and set filter to speed things up
This commit is contained in:
parent
7fed084bda
commit
b40d54cd10
@ -122,8 +122,8 @@ class BlocklistImport:
|
||||
self.gtkprog.stop()
|
||||
reader.close()
|
||||
return
|
||||
|
||||
|
||||
self.core.set_ip_filter()
|
||||
reader.close()
|
||||
self.nimported = curr
|
||||
self.gtkprog.end_import()
|
||||
|
@ -916,6 +916,9 @@ class Manager:
|
||||
def add_range_to_ip_filter(self, start, end):
|
||||
return deluge_core.add_range_to_IP_filter(start, end)
|
||||
|
||||
def set_ip_filter(self):
|
||||
return deluge_core.set_IP_filter()
|
||||
|
||||
def proxy_settings(self, server, login, paswd, portnum, proxytype, proxy):
|
||||
return deluge_core.proxy_settings(server, login, paswd, portnum, proxytype, proxy)
|
||||
|
||||
|
@ -1484,10 +1484,21 @@ static PyObject *torrent_add_range_to_IP_filter(PyObject *self, PyObject *args)
|
||||
address_v4 inet_start = address_v4::from_string(start);
|
||||
address_v4 inet_end = address_v4::from_string(end);
|
||||
M_the_filter->add_rule(inet_start, inet_end, ip_filter::blocked);
|
||||
M_ses->set_ip_filter(*M_the_filter);
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *torrent_set_IP_filter(PyObject *self, PyObject *args)
|
||||
{
|
||||
if (M_the_filter == NULL) {
|
||||
RAISE_PTR(DelugeError, "No filter defined, use reset_IP_filter");
|
||||
}
|
||||
M_ses->set_ip_filter(*M_the_filter);
|
||||
|
||||
Py_INCREF(Py_None); return Py_None;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *torrent_use_upnp(PyObject *self, PyObject *args)
|
||||
{
|
||||
python_long action;
|
||||
@ -1854,6 +1865,7 @@ static PyMethodDef deluge_core_methods[] =
|
||||
{"create_torrent", torrent_create_torrent, METH_VARARGS, "."},
|
||||
{"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."},
|
||||
{"add_range_to_IP_filter", torrent_add_range_to_IP_filter, METH_VARARGS, "."},
|
||||
{"set_IP_filter", torrent_set_IP_filter, METH_VARARGS, "."},
|
||||
{"use_upnp", torrent_use_upnp, METH_VARARGS, "."},
|
||||
{"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."},
|
||||
{"use_utpex", torrent_use_utpex, METH_VARARGS, "."},
|
||||
|
Loading…
x
Reference in New Issue
Block a user