From 228597abdcc83c7328082e63580aa1e1e2e9539e Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Thu, 5 Jun 2008 02:12:57 +0000 Subject: [PATCH] add send redundant haves iow show peers our progress --- glade/preferences_dialog.glade | 53 +++++++++++++++++++++++++++++----- src/core.py | 1 + src/deluge_core.cpp | 18 ++++++++++++ src/dialogs.py | 2 ++ src/pref.py | 2 ++ 5 files changed, 68 insertions(+), 8 deletions(-) diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 38eb55446..6ed802094 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -911,7 +911,7 @@ Forced - + True 1 Level: @@ -1751,7 +1751,7 @@ HTTP W/ Auth - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Proxy type @@ -2403,6 +2403,42 @@ HTTP W/ Auth True 2 + + + True + 0 + GTK_SHADOW_NONE + + + True + 12 + + + True + True + Have messages will be sent to peers that already have the piece. It adds a little overhead, but allows other clients to see our progress. + Send Redundant Have + 0 + True + + + + + + + True + <b>Peers</b> + True + + + label_item + + + + + False + + True @@ -2548,7 +2584,7 @@ HTTP W/ Auth - + True <b>System Tray</b> True @@ -2561,6 +2597,7 @@ HTTP W/ Auth False 2 + 1 @@ -2601,7 +2638,7 @@ HTTP W/ Auth False False - 1 + 2 @@ -2653,7 +2690,7 @@ HTTP W/ Auth False False - 2 + 3 @@ -2696,7 +2733,7 @@ information is sent. False False - 3 + 4 @@ -2708,7 +2745,7 @@ information is sent. - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Other @@ -2838,7 +2875,7 @@ information is sent. - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Plugins diff --git a/src/core.py b/src/core.py index 6dec828f4..8041d0e94 100644 --- a/src/core.py +++ b/src/core.py @@ -83,6 +83,7 @@ PREF_FUNCTIONS = { "use_lsd" : deluge_core.use_lsd, "use_natpmp" : deluge_core.use_natpmp, "use_utpex" : deluge_core.use_utpex, + "send_redund" : deluge_core.send_redund, } STATE_MESSAGES = (_("Queued"), diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 64f79a17b..b1ae82fe0 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -2165,6 +2165,23 @@ std::cout << asctime(timeinfo) << " torrent_use_lsd()" << std::endl; Py_INCREF(Py_None); return Py_None; } +static PyObject *torrent_send_redund(PyObject *self, PyObject *args) +{ +#ifdef DELUGE_CORE_DEBUG +time_t rawtime; +struct tm *timeinfo; +time(&rawtime); +timeinfo = localtime(&rawtime); +std::cout << asctime(timeinfo) << " torrent_send_redund()" << std::endl; +#endif + python_long action; + PyArg_ParseTuple(args, "i", &action); + + M_settings->send_redundant_have = action; + M_ses->set_settings(*M_settings); + Py_INCREF(Py_None); return Py_None; +} + static PyObject *torrent_use_natpmp(PyObject *self, PyObject *args) { #ifdef DELUGE_CORE_DEBUG @@ -2662,6 +2679,7 @@ static PyMethodDef deluge_core_methods[] = {"set_IP_filter", torrent_set_IP_filter, METH_VARARGS, "."}, {"use_upnp", torrent_use_upnp, METH_VARARGS, "."}, {"use_lsd", torrent_use_lsd, METH_VARARGS, "."}, + {"send_redund", torrent_send_redund, METH_VARARGS, "."}, {"use_natpmp", torrent_use_natpmp, METH_VARARGS, "."}, {"use_utpex", torrent_use_utpex, METH_VARARGS, "."}, {"set_ratio", torrent_set_ratio, METH_VARARGS, "."}, diff --git a/src/dialogs.py b/src/dialogs.py index 2220aca3d..53e5d042e 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -90,6 +90,7 @@ class PreferencesDlg: self.glade.get_widget("chk_web_proxy").set_active(self.preferences.get("web_proxy")) self.glade.get_widget("chk_upnp").set_active(self.preferences.get("use_upnp")) self.glade.get_widget("chk_lsd").set_active(self.preferences.get("use_lsd")) + self.glade.get_widget("chk_send_redund").set_active(self.preferences.get("send_redund")) self.glade.get_widget("chk_random_port").set_active(self.preferences.get("random_port")) self.glade.get_widget("chk_natpmp").set_active(self.preferences.get("use_natpmp")) self.glade.get_widget("chk_utpex").set_active(self.preferences.get("use_utpex")) @@ -209,6 +210,7 @@ class PreferencesDlg: self.preferences.set("web_proxy", self.glade.get_widget("chk_web_proxy").get_active()) self.preferences.set("use_upnp", self.glade.get_widget("chk_upnp").get_active()) self.preferences.set("use_lsd", self.glade.get_widget("chk_lsd").get_active()) + self.preferences.set("send_redund", self.glade.get_widget("chk_send_redund").get_active()) self.preferences.set("tracker_proxy_type", self.glade.get_widget("combo_tracker_proxy_type").get_active()) self.preferences.set("dht_proxy_type", self.glade.get_widget("combo_dht_proxy_type").get_active()) self.preferences.set("web_proxy_type", self.glade.get_widget("combo_web_proxy_type").get_active()) diff --git a/src/pref.py b/src/pref.py index 1808263eb..3ffbdd9f1 100644 --- a/src/pref.py +++ b/src/pref.py @@ -44,6 +44,7 @@ if common.windows_check(): "enabled_plugins" : "Torrent Files:Torrent Peers:Torrent Peers:Torrent Notification", "file_manager" : common.FileManager.xdg, "open_folder_stock" : True, + "send_redund" : False, "autoload" : False, "open_folder_location": "", "send_info" : True, @@ -162,6 +163,7 @@ else: "enabled_plugins" : "Torrent Files:Torrent Peers:Torrent Notification", "file_manager" : common.FileManager.xdg, "open_folder_stock" : True, + "send_redund" : False, "autoload" : False, "open_folder_location": "", "send_info" : True,