* torrent::Peer now is used as a pointer, instead of an instance

containing a pointer.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1007 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-11-13 11:33:39 +00:00
parent 3f644aed8f
commit 2fe964059f
4 changed files with 29 additions and 29 deletions
+20 -20
View File
@@ -95,62 +95,62 @@ WindowPeerList::redraw() {
throw std::logic_error("WindowPeerList::redraw() m_slotChunksTotal() returned invalid value");
while (range.first != range.second) {
torrent::Peer& p = *range.first;
torrent::Peer* p = *range.first;
x = 0;
m_canvas->print(x, y, "%c %s",
range.first == *m_focus ? '*' : ' ',
rak::socket_address::cast_from(p.address())->address_str().c_str());
rak::socket_address::cast_from(p->address())->address_str().c_str());
x += 18;
m_canvas->print(x, y, "%.1f", (double)p.up_rate()->rate() / 1024); x += 7;
m_canvas->print(x, y, "%.1f", (double)p.down_rate()->rate() / 1024); x += 7;
m_canvas->print(x, y, "%.1f", (double)p.peer_rate()->rate() / 1024); x += 7;
m_canvas->print(x, y, "%.1f", (double)p->up_rate()->rate() / 1024); x += 7;
m_canvas->print(x, y, "%.1f", (double)p->down_rate()->rate() / 1024); x += 7;
m_canvas->print(x, y, "%.1f", (double)p->peer_rate()->rate() / 1024); x += 7;
char remoteChoked;
if (!p.is_remote_choked_limited())
if (!p->is_remote_choked_limited())
remoteChoked = 'U';
else if (p.is_remote_queued())
else if (p->is_remote_queued())
remoteChoked = 'Q';
else
remoteChoked = 'C';
m_canvas->print(x, y, "%c/%c%c/%c%c",
p.is_encrypted() ? (p.is_incoming() ? 'R' : 'L') : (p.is_incoming() ? 'r' : 'l'),
p.is_remote_choked() ? std::tolower(remoteChoked) : remoteChoked,
p->is_encrypted() ? (p->is_incoming() ? 'R' : 'L') : (p->is_incoming() ? 'r' : 'l'),
p->is_remote_choked() ? std::tolower(remoteChoked) : remoteChoked,
p.is_remote_interested() ? 'i' : 'n',
p.is_local_choked() ? 'c' : 'u',
p.is_local_interested() ? 'i' : 'n');
p->is_remote_interested() ? 'i' : 'n',
p->is_local_choked() ? 'c' : 'u',
p->is_local_interested() ? 'i' : 'n');
x += 9;
m_canvas->print(x, y, "%i/%i", p.outgoing_queue_size(), p.incoming_queue_size());
m_canvas->print(x, y, "%i/%i", p->outgoing_queue_size(), p->incoming_queue_size());
x += 6;
m_canvas->print(x, y, "%3i", done_percentage(*range.first));
x += 6;
const torrent::BlockTransfer* transfer = p.transfer();
const torrent::BlockTransfer* transfer = p->transfer();
if (transfer != NULL)
m_canvas->print(x, y, "%i", transfer->index());
x += 6;
if (p.is_snubbed())
if (p->is_snubbed())
m_canvas->print(x, y, "*");
x += 6;
if (p.failed_counter() != 0)
m_canvas->print(x, y, "%u", p.failed_counter());
if (p->failed_counter() != 0)
m_canvas->print(x, y, "%u", p->failed_counter());
x += 7;
char buf[128];
print_client_version(buf, buf + 128, p.info()->client_info());
print_client_version(buf, buf + 128, p->info()->client_info());
m_canvas->print(x, y, "%s", buf);
@@ -160,10 +160,10 @@ WindowPeerList::redraw() {
}
int
WindowPeerList::done_percentage(torrent::Peer& p) {
WindowPeerList::done_percentage(torrent::Peer* p) {
int chunks = m_download->download()->file_list()->size_chunks();
return chunks ? (100 * p.chunks_done()) / chunks : 0;
return chunks ? (100 * p->chunks_done()) / chunks : 0;
}
}
+2 -2
View File
@@ -50,14 +50,14 @@ namespace display {
class WindowPeerList : public Window {
public:
typedef std::list<torrent::Peer> PList;
typedef std::list<torrent::Peer*> PList;
WindowPeerList(core::Download* d, PList* l, PList::iterator* f);
virtual void redraw();
private:
int done_percentage(torrent::Peer& p);
int done_percentage(torrent::Peer* p);
core::Download* m_download;