mirror of
https://git.deluge-torrent.org/deluge
synced 2025-09-27 12:38:33 +00:00
speedlimiter fixes
This commit is contained in:
parent
d8482a3fc9
commit
1addf2541a
3 changed files with 6 additions and 10 deletions
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue