diff --git a/plugins/SpeedLimiter/__init__.py b/plugins/SpeedLimiter/__init__.py index 8bcfb9ce3..e11553d33 100644 --- a/plugins/SpeedLimiter/__init__.py +++ b/plugins/SpeedLimiter/__init__.py @@ -56,14 +56,14 @@ class DesiredSpeed: unique_ID = self.core.get_torrent_unique_id(torrent) try: if self.core.unique_IDs[unique_ID].upload_rate_limit != -1: - value = int(self.core.unique_IDs[unique_ID].upload_rate_limit / 1024) + value = int(self.core.unique_IDs[unique_ID].upload_rate_limit) self.core.set_per_upload_rate_limit(unique_ID, value) self.set_up_speeds[unique_ID] = value if value not in self.config.get("up_speeds") and value >= 1: self.config.get("up_speeds").insert(0, value) self.config.get("up_speeds").pop() if self.core.unique_IDs[unique_ID].download_rate_limit != -1: - value = int(self.core.unique_IDs[unique_ID].download_rate_limit / 1024) + value = int(self.core.unique_IDs[unique_ID].download_rate_limit) self.core.set_per_download_rate_limit(unique_ID, value) self.set_down_speeds[unique_ID] = value if value not in self.config.get("down_speeds") and value >= 1: @@ -157,7 +157,7 @@ class DesiredSpeed: self.core.set_per_upload_rate_limit(self.unique_ID, value) self.set_up_speeds[self.unique_ID] = value - self.core.unique_IDs[self.unique_ID].upload_rate_limit = value * 1024 + self.core.unique_IDs[self.unique_ID].upload_rate_limit = value # Update the speeds list if necessary if value not in self.config.get("up_speeds") and value >= 1: @@ -189,7 +189,7 @@ class DesiredSpeed: self.core.set_per_download_rate_limit(self.unique_ID, value) self.set_down_speeds[self.unique_ID] = value - self.core.unique_IDs[self.unique_ID].download_rate_limit = value * 1024 + self.core.unique_IDs[self.unique_ID].download_rate_limit = value # update the speeds list if necessary if value not in self.config.get("down_speeds") and value >= 0: diff --git a/src/core.py b/src/core.py index 925705dc6..3f76a1395 100644 --- a/src/core.py +++ b/src/core.py @@ -1036,13 +1036,9 @@ class Manager: max_upload_slots) def set_per_upload_rate_limit(self, unique_ID, speed): - if speed != -1: - speed = speed * 1024 return deluge_core.set_per_upload_rate_limit(unique_ID, speed) def set_per_download_rate_limit(self, unique_ID, speed): - if speed != -1: - speed = speed * 1024 return deluge_core.set_per_download_rate_limit(unique_ID, speed) def get_per_upload_rate_limit(self, unique_ID): diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 5949c3ccd..f35a4f278 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -508,7 +508,7 @@ static PyObject *torrent_set_per_upload_rate_limit(PyObject *self, PyObject *arg return NULL; if (M_torrents->at(index).handle.is_valid()) - M_torrents->at(index).handle.set_upload_limit(speed); + M_torrents->at(index).handle.set_upload_limit(speed * 1024); Py_INCREF(Py_None); return Py_None; } @@ -538,7 +538,7 @@ static PyObject *torrent_set_per_download_rate_limit(PyObject *self, PyObject *a if (PyErr_Occurred()) return NULL; if (M_torrents->at(index).handle.is_valid()) - M_torrents->at(index).handle.set_download_limit(speed); + M_torrents->at(index).handle.set_download_limit(speed * 1024); Py_INCREF(Py_None); return Py_None; }