diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index d30d0cacc..4c06b68f7 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -63,12 +63,10 @@ static QPair get_file_extremity_pieces(const torrent_info& t, int file // Determine the first and last piece of the file int first_piece = floor((file.offset + 1) / (float) piece_size); Q_ASSERT(first_piece >= 0 && first_piece < num_pieces); - qDebug("First piece of the file is %d/%d", first_piece, num_pieces - 1); int num_pieces_in_file = ceil(file.size / (float) piece_size); int last_piece = first_piece + num_pieces_in_file - 1; Q_ASSERT(last_piece >= 0 && last_piece < num_pieces); - qDebug("last piece of the file is %d/%d", last_piece, num_pieces - 1); return qMakePair(first_piece, last_piece); } diff --git a/src/webui/abstractrequesthandler.cpp b/src/webui/abstractrequesthandler.cpp index 6d6fa1c8b..8753e9409 100644 --- a/src/webui/abstractrequesthandler.cpp +++ b/src/webui/abstractrequesthandler.cpp @@ -45,8 +45,6 @@ AbstractRequestHandler::AbstractRequestHandler(const HttpRequest &request, const HttpResponse AbstractRequestHandler::run() { - response_ = HttpResponse(); - if (isBanned()) { status(403, "Forbidden"); print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."), CONTENT_TYPE_TXT); diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index 0f422b4ad..1c8190fd2 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -45,6 +45,7 @@ #endif #include +#include using namespace libtorrent; @@ -135,8 +136,10 @@ static const char KEY_FILE_IS_SEED[] = "is_seed"; // TransferInfo keys static const char KEY_TRANSFER_DLSPEED[] = "dl_info_speed"; static const char KEY_TRANSFER_DLDATA[] = "dl_info_data"; +static const char KEY_TRANSFER_DLRATELIMIT[] = "dl_rate_limit"; static const char KEY_TRANSFER_UPSPEED[] = "up_info_speed"; static const char KEY_TRANSFER_UPDATA[] = "up_info_data"; +static const char KEY_TRANSFER_UPRATELIMIT[] = "up_rate_limit"; class QTorrentCompare { @@ -448,9 +451,14 @@ QByteArray btjson::getTransferInfo() { CACHED_VARIABLE(QVariantMap, info, CACHE_DURATION_MS); session_status sessionStatus = QBtSession::instance()->getSessionStatus(); + session_settings sessionSettings = QBtSession::instance()->getSession()->settings(); info[KEY_TRANSFER_DLSPEED] = sessionStatus.payload_download_rate; info[KEY_TRANSFER_DLDATA] = static_cast(sessionStatus.total_payload_download); info[KEY_TRANSFER_UPSPEED] = sessionStatus.payload_upload_rate; info[KEY_TRANSFER_UPDATA] = static_cast(sessionStatus.total_payload_upload); + if (sessionSettings.download_rate_limit) + info[KEY_TRANSFER_DLRATELIMIT] = sessionSettings.download_rate_limit; + if (sessionSettings.upload_rate_limit) + info[KEY_TRANSFER_UPRATELIMIT] = sessionSettings.upload_rate_limit; return json::toJson(info); } diff --git a/src/webui/www/public/downloadlimit.html b/src/webui/www/public/downloadlimit.html index 1cf3ae6e5..74f7c8a8f 100644 --- a/src/webui/www/public/downloadlimit.html +++ b/src/webui/www/public/downloadlimit.html @@ -4,7 +4,6 @@ _(Torrent Download Speed Limiting) - @@ -13,7 +12,7 @@
-
_(Download limit:) 0 _(KiB/s)
+
_(Download limit:) _(KiB/s)
@@ -23,7 +22,7 @@ @@ -13,7 +12,7 @@
-
_(Upload limit:) 0 _(KiB/s)
+
_(Upload limit:) _(KiB/s)
@@ -23,7 +22,7 @@