From fc12ade03a8134c1b6ed0c19c20680ad0a2b393e Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sun, 7 Oct 2007 22:47:24 +0000 Subject: [PATCH] account for '-1', oops --- src/deluge_core.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index f35a4f278..eb0d542f7 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -502,13 +502,14 @@ static PyObject *torrent_set_per_upload_rate_limit(PyObject *self, PyObject *arg python_long unique_ID, speed; if (!PyArg_ParseTuple(args, "ii", &unique_ID, &speed)) return NULL; - + if (speed != -1) + speed = speed * 1024; long index = get_index_from_unique_ID(unique_ID); if (PyErr_Occurred()) return NULL; if (M_torrents->at(index).handle.is_valid()) - M_torrents->at(index).handle.set_upload_limit(speed * 1024); + M_torrents->at(index).handle.set_upload_limit(speed); Py_INCREF(Py_None); return Py_None; } @@ -533,12 +534,13 @@ static PyObject *torrent_set_per_download_rate_limit(PyObject *self, PyObject *a if (!PyArg_ParseTuple(args, "ii", &unique_ID, &speed)) return NULL; - + if (speed != -1) + speed = speed * 1024; long index = get_index_from_unique_ID(unique_ID); if (PyErr_Occurred()) return NULL; if (M_torrents->at(index).handle.is_valid()) - M_torrents->at(index).handle.set_download_limit(speed * 1024); + M_torrents->at(index).handle.set_download_limit(speed); Py_INCREF(Py_None); return Py_None; }