separate add rule and set filter to speed things up

This commit is contained in:
Marcos Pinto 2007-08-02 18:20:24 +00:00
parent 7fed084bda
commit b40d54cd10
3 changed files with 17 additions and 2 deletions

View File

@ -122,8 +122,8 @@ class BlocklistImport:
self.gtkprog.stop() self.gtkprog.stop()
reader.close() reader.close()
return return
self.core.set_ip_filter()
reader.close() reader.close()
self.nimported = curr self.nimported = curr
self.gtkprog.end_import() self.gtkprog.end_import()

View File

@ -916,6 +916,9 @@ class Manager:
def add_range_to_ip_filter(self, start, end): def add_range_to_ip_filter(self, start, end):
return deluge_core.add_range_to_IP_filter(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): def proxy_settings(self, server, login, paswd, portnum, proxytype, proxy):
return deluge_core.proxy_settings(server, login, paswd, portnum, proxytype, proxy) return deluge_core.proxy_settings(server, login, paswd, portnum, proxytype, proxy)

View File

@ -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_start = address_v4::from_string(start);
address_v4 inet_end = address_v4::from_string(end); address_v4 inet_end = address_v4::from_string(end);
M_the_filter->add_rule(inet_start, inet_end, ip_filter::blocked); 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; 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) static PyObject *torrent_use_upnp(PyObject *self, PyObject *args)
{ {
python_long action; python_long action;
@ -1854,6 +1865,7 @@ static PyMethodDef deluge_core_methods[] =
{"create_torrent", torrent_create_torrent, METH_VARARGS, "."}, {"create_torrent", torrent_create_torrent, METH_VARARGS, "."},
{"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."}, {"reset_IP_filter", torrent_reset_IP_filter, METH_VARARGS, "."},
{"add_range_to_IP_filter", torrent_add_range_to_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_upnp", torrent_use_upnp, METH_VARARGS, "."},
{"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."}, {"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."},
{"use_utpex", torrent_use_utpex, METH_VARARGS, "."}, {"use_utpex", torrent_use_utpex, METH_VARARGS, "."},