add connection_speed setting

This commit is contained in:
Marcos Pinto 2007-11-24 03:51:11 +00:00
parent adb7bcdf38
commit dde291d6dd
5 changed files with 46 additions and 1 deletions

View File

@ -1175,8 +1175,37 @@ Either</property>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">5</property>
<property name="n_rows">6</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkSpinButton" id="spin_connection_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip" translatable="yes">The maximum half-open connections. A high value may crash some cheap routers. Set -1 for unlimited.</property>
<property name="xalign">1</property>
<property name="adjustment">-1 -1 9000 1 10 10</property>
<property name="climb_rate">1</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label43">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">The maximum half-open connections. A high value may crash some cheap routers. Set -1 for unlimited.</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Maximum Connection Attempts per Second:</property>
</widget>
<packing>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_max_upload_slots_global">
<property name="visible">True</property>

View File

@ -70,6 +70,7 @@ DHT_FILENAME = "dht.state"
PREF_FUNCTIONS = {
"listen_on" : deluge_core.set_listen_on,
"max_half_open" : deluge_core.set_max_half_open,
"connection_speed" : deluge_core.connection_speed,
"max_connections_global" : deluge_core.set_max_connections_global,
"max_active_torrents" : None, # no need for a function, applied constantly
"max_upload_slots_global" : deluge_core.set_max_upload_slots_global,

View File

@ -510,6 +510,16 @@ static PyObject *torrent_set_max_half_open(PyObject *self, PyObject *args)
Py_INCREF(Py_None); return Py_None;
}
static PyObject *torrent_connection_speed(PyObject *self, PyObject *args)
{
python_long arg;
if (!PyArg_ParseTuple(args, "i", &arg))
return NULL;
M_settings->connection_speed = arg;
M_ses->set_settings(*M_settings);
Py_INCREF(Py_None); return Py_None;
}
static PyObject *torrent_set_download_rate_limit(PyObject *self, PyObject *args)
{
@ -2022,6 +2032,7 @@ static PyMethodDef deluge_core_methods[] =
{"quit", torrent_quit, METH_VARARGS, "."},
{"save_fastresume", torrent_save_fastresume, METH_VARARGS, "."},
{"set_max_half_open", torrent_set_max_half_open, METH_VARARGS, "."},
{"connection_speed", torrent_connection_speed, METH_VARARGS, "."},
{"set_download_rate_limit", torrent_set_download_rate_limit, METH_VARARGS, "."},
{"set_upload_rate_limit", torrent_set_upload_rate_limit, METH_VARARGS, "."},
{"set_per_upload_rate_limit", torrent_set_per_upload_rate_limit, METH_VARARGS, "."},

View File

@ -144,6 +144,7 @@ class PreferencesDlg:
self.glade.get_widget("spin_dht_proxy_port").set_value(self.preferences.get("dht_proxy_port"))
self.glade.get_widget("spin_web_proxy_port").set_value(self.preferences.get("web_proxy_port"))
self.glade.get_widget("spin_max_half_open").set_value(float(self.preferences.get("max_half_open")))
self.glade.get_widget("spin_connection_speed").set_value(float(self.preferences.get("connection_speed")))
self.glade.get_widget("spin_torrents").set_value(float(self.preferences.get("max_active_torrents")))
self.glade.get_widget("chk_seedbottom").set_active(self.preferences.get("queue_seeds_to_bottom"))
self.glade.get_widget("chk_queue_above_completed").set_sensitive(self.preferences.get("queue_seeds_to_bottom"))
@ -269,6 +270,7 @@ class PreferencesDlg:
self.preferences.set("max_connections_global", int(self.glade.get_widget("spin_max_connections_global").get_value()))
self.preferences.set("max_connections_per_torrent", int(self.glade.get_widget("spin_max_connections_per_torrent").get_value()))
self.preferences.set("max_half_open", int(self.glade.get_widget("spin_max_half_open").get_value()))
self.preferences.set("connection_speed", int(self.glade.get_widget("spin_connection_speed").get_value()))
self.preferences.set("max_active_torrents", int(self.glade.get_widget("spin_torrents").get_value()))
self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active())
self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active())

View File

@ -70,6 +70,7 @@ if common.windows_check():
"listen_on" : [6881,6889],
"lock_tray" : False,
"max_half_open" : 8,
"connection_speed" : -1,
"max_active_torrents" : 8,
"max_active_torrents_tmp" : 8,
"max_connections_global" : 200,
@ -183,6 +184,7 @@ else:
"listen_on" : [6881,6889],
"lock_tray" : False,
"max_half_open" : 20,
"connection_speed" : -1,
"max_active_torrents" : 8,
"max_active_torrents_tmp" : 8,
"max_connections_global" : 200,