mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-07 06:39:23 +00:00
* Reverse the color of currently downloading chunks in chunks
seen. Patch by Josef Drexler, public domain. * Moving various stuff from Delegator to TransferList. * Added checks in HandshakeManager::receive_* to check for invalid handshakes. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@716 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -40,6 +40,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <rak/string_manip.h>
|
#include <rak/string_manip.h>
|
||||||
#include <torrent/bitfield.h>
|
#include <torrent/bitfield.h>
|
||||||
|
#include <torrent/transfer_list.h>
|
||||||
|
#include <torrent/block_list.h>
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
|
|
||||||
@@ -74,12 +76,25 @@ WindowDownloadChunksSeen::redraw() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_download->is_done()) {
|
||||||
|
m_canvas->print(36, 0, "X downloaded missing downloading");
|
||||||
|
m_canvas->print_char(50, 0, 'X' | A_BOLD);
|
||||||
|
m_canvas->print_char(61, 0, 'X' | A_REVERSE);
|
||||||
|
}
|
||||||
|
|
||||||
*m_focus = std::min(*m_focus, max_focus());
|
*m_focus = std::min(*m_focus, max_focus());
|
||||||
|
|
||||||
const uint8_t* chunk = seen + *m_focus * chunks_per_row();
|
const uint8_t* chunk = seen + *m_focus * chunks_per_row();
|
||||||
const uint8_t* last = seen + m_download->download()->chunks_total();
|
const uint8_t* last = seen + m_download->download()->chunks_total();
|
||||||
|
|
||||||
const torrent::Bitfield* bitfield = m_download->download()->bitfield();
|
const torrent::Bitfield* bitfield = m_download->download()->bitfield();
|
||||||
|
const torrent::TransferList* transfers = m_download->download()->transfer_list();
|
||||||
|
std::vector<uint32_t> transferChunks(transfers->size(), 0);
|
||||||
|
|
||||||
|
std::transform(transfers->begin(), transfers->end(), transferChunks.begin(), std::mem_fun(&torrent::BlockList::index));
|
||||||
|
std::sort(transferChunks.begin(), transferChunks.end());
|
||||||
|
|
||||||
|
std::vector<uint32_t>::const_iterator itrTransfer = transferChunks.begin();
|
||||||
|
|
||||||
for (int y = 1; y < m_canvas->get_height() && chunk < last; ++y) {
|
for (int y = 1; y < m_canvas->get_height() && chunk < last; ++y) {
|
||||||
m_canvas->print(0, y, "%5d ", (int)(chunk - seen));
|
m_canvas->print(0, y, "%5d ", (int)(chunk - seen));
|
||||||
@@ -87,12 +102,14 @@ WindowDownloadChunksSeen::redraw() {
|
|||||||
while (chunk < last) {
|
while (chunk < last) {
|
||||||
chtype attr;
|
chtype attr;
|
||||||
|
|
||||||
if (bitfield->get(chunk - seen))
|
if (bitfield->get(chunk - seen)) {
|
||||||
attr = A_NORMAL;
|
attr = A_NORMAL;
|
||||||
// else if (foo->is_downloading(chunk - seen))
|
} else if (itrTransfer != transferChunks.end() && (uint32_t)(chunk - seen) == *itrTransfer) {
|
||||||
// attr = A_UNDERLINE;
|
attr = A_REVERSE;
|
||||||
else
|
itrTransfer++;
|
||||||
|
} else {
|
||||||
attr = A_BOLD;
|
attr = A_BOLD;
|
||||||
|
}
|
||||||
|
|
||||||
m_canvas->print_char(attr | rak::value_to_hexchar<0>(std::min<uint8_t>(*chunk, 0xF)));
|
m_canvas->print_char(attr | rak::value_to_hexchar<0>(std::min<uint8_t>(*chunk, 0xF)));
|
||||||
chunk++;
|
chunk++;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <rak/socket_address.h>
|
#include <rak/socket_address.h>
|
||||||
|
#include <torrent/block_transfer.h>
|
||||||
#include <torrent/rate.h>
|
#include <torrent/rate.h>
|
||||||
#include <torrent/piece.h>
|
#include <torrent/piece.h>
|
||||||
|
|
||||||
@@ -112,16 +113,16 @@ WindowPeerList::redraw() {
|
|||||||
p.is_local_interested() ? 'i' : 'n');
|
p.is_local_interested() ? 'i' : 'n');
|
||||||
x += 9;
|
x += 9;
|
||||||
|
|
||||||
m_canvas->print(x, y, "%i/%i",
|
m_canvas->print(x, y, "%i/%i", p.outgoing_queue_size(), p.incoming_queue_size());
|
||||||
p.outgoing_queue_size(),
|
|
||||||
p.incoming_queue_size());
|
|
||||||
x += 6;
|
x += 6;
|
||||||
|
|
||||||
m_canvas->print(x, y, "%3i", done_percentage(*range.first));
|
m_canvas->print(x, y, "%3i", done_percentage(*range.first));
|
||||||
x += 6;
|
x += 6;
|
||||||
|
|
||||||
if (p.incoming_queue_size())
|
const torrent::BlockTransfer* transfer = p.transfer();
|
||||||
m_canvas->print(x, y, "%i", p.incoming_queue(0)->index());
|
|
||||||
|
if (transfer != NULL)
|
||||||
|
m_canvas->print(x, y, "%i", transfer->index());
|
||||||
|
|
||||||
x += 6;
|
x += 6;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user