Removed priority_queue and rak/timer.

This commit is contained in:
Jari Sundell
2025-05-02 11:03:51 +02:00
committed by GitHub
parent 6f8c1246dc
commit 85e74b5542
65 changed files with 384 additions and 1933 deletions
+11 -48
View File
@@ -1,55 +1,19 @@
// rTorrent - BitTorrent client
// Copyright (C) 2005-2011, Jari Sundell
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations
// including the two.
//
// You must obey the GNU General Public License in all respects for
// all of the code used other than OpenSSL. If you modify file(s)
// with this exception, you may extend this exception to your version
// of the file(s), but you are not obligated to do so. If you do not
// wish to do so, delete this exception statement from your version.
// If you delete this exception statement from all source files in the
// program, then also delete it here.
//
// Contact: Jari Sundell <jaris@ifi.uio.no>
//
// Skomakerveien 33
// 3185 Skoppum, NORWAY
#include "config.h"
#include "display/window_http_queue.h"
#include <stdexcept>
#include "core/curl_get.h"
#include "core/http_queue.h"
#include "canvas.h"
#include "window_http_queue.h"
#include "display/canvas.h"
namespace display {
WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
Window(new Canvas, 0, 0, 1, extent_full, 1),
m_queue(q) {
set_active(false);
m_connInsert = m_queue->signal_insert().insert(m_queue->signal_insert().end(),
std::bind(&WindowHttpQueue::receive_insert,
@@ -63,16 +27,15 @@ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
void
WindowHttpQueue::redraw() {
m_slotSchedule(this, (cachedTime + rak::timer::from_seconds(1)).round_seconds());
schedule_update();
cleanup_list();
if (m_container.empty()) {
set_active(false);
m_slotAdjust();
m_slot_adjust();
return;
}
}
m_canvas->erase();
m_canvas->print(0, 0, "Http [%i]", m_queue->size());
@@ -98,7 +61,7 @@ WindowHttpQueue::redraw() {
void
WindowHttpQueue::cleanup_list() {
for (Container::iterator itr = m_container.begin(); itr != m_container.end();)
if (itr->m_http == NULL && itr->m_timer < cachedTime)
if (itr->m_http == NULL && itr->m_timer < torrent::this_thread::cached_time())
itr = m_container.erase(itr);
else
++itr;
@@ -136,9 +99,9 @@ WindowHttpQueue::receive_insert(core::CurlGet* h) {
if (!is_active()) {
set_active(true);
m_slotAdjust();
m_slot_adjust();
}
mark_dirty();
}
@@ -150,7 +113,7 @@ WindowHttpQueue::receive_erase(core::CurlGet* h) {
throw std::logic_error("WindowHttpQueue::receive_erase(...) tried to remove an object we don't have");
itr->m_http = NULL;
itr->m_timer = cachedTime + rak::timer::from_seconds(1);
itr->m_timer = torrent::this_thread::cached_time() + 1s;
mark_dirty();
}