From 13e56ca02d4250b037853953afca493eb7d40bb2 Mon Sep 17 00:00:00 2001 From: Aurelien Desbrieres Date: Fri, 19 Dec 2014 18:50:17 +0100 Subject: BitTorrent library written in C++ with eXtended patches. --- pcr/libtorrent-extended/ui_show_idle_times.patch | 61 ++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 pcr/libtorrent-extended/ui_show_idle_times.patch (limited to 'pcr/libtorrent-extended/ui_show_idle_times.patch') diff --git a/pcr/libtorrent-extended/ui_show_idle_times.patch b/pcr/libtorrent-extended/ui_show_idle_times.patch new file mode 100644 index 000000000..d5410a63c --- /dev/null +++ b/pcr/libtorrent-extended/ui_show_idle_times.patch @@ -0,0 +1,61 @@ +diff --git a/src/protocol/peer_connection_base.cc b/src/protocol/peer_connection_base.cc +index 9eddbb8..7985ad2 100644 +--- a/src/protocol/peer_connection_base.cc ++++ b/src/protocol/peer_connection_base.cc +@@ -410,6 +410,8 @@ PeerConnectionBase::down_chunk() { + return false; + } + ++ m_peerInfo->set_last_transfer_down(cachedTime.seconds()); ++ + uint32_t bytesTransfered = 0; + BlockTransfer* transfer = m_downloadQueue.transfer(); + +@@ -642,6 +644,8 @@ PeerConnectionBase::up_chunk() { + return false; + } + ++ m_peerInfo->set_last_transfer_up(cachedTime.seconds()); ++ + uint32_t bytesTransfered = 0; + + if (is_encrypted()) { +diff --git a/src/torrent/peer/peer_info.cc b/src/torrent/peer/peer_info.cc +index 06f9ae8..6bd1db0 100644 +--- a/src/torrent/peer/peer_info.cc ++++ b/src/torrent/peer/peer_info.cc +@@ -54,6 +54,8 @@ PeerInfo::PeerInfo(const sockaddr* address) : + m_failedCounter(0), + m_transferCounter(0), + m_lastConnection(0), ++ m_lastTransferUp(0), ++ m_lastTransferDown(0), + m_lastHandshake(0), + m_listenPort(0), + +diff --git a/src/torrent/peer/peer_info.h b/src/torrent/peer/peer_info.h +index 5a6fe22..584ce86 100644 +--- a/src/torrent/peer/peer_info.h ++++ b/src/torrent/peer/peer_info.h +@@ -100,6 +100,12 @@ public: + uint32_t last_connection() const { return m_lastConnection; } + void set_last_connection(uint32_t tvsec) { m_lastConnection = tvsec; } + ++ uint32_t last_transfer_up() const { return m_lastTransferUp; } ++ uint32_t last_transfer_down() const { return m_lastTransferDown; } ++ uint32_t last_transfer() const { return std::max(m_lastTransferUp, m_lastTransferDown); } ++ void set_last_transfer_up(uint32_t tvsec) { m_lastTransferUp = tvsec; } ++ void set_last_transfer_down(uint32_t tvsec){ m_lastTransferDown = tvsec; } ++ + uint32_t last_handshake() const { return m_lastHandshake; } + void set_last_handshake(uint32_t tvsec) { m_lastHandshake = tvsec; } + +@@ -137,6 +143,8 @@ private: + uint32_t m_failedCounter; + uint32_t m_transferCounter; + uint32_t m_lastConnection; ++ uint32_t m_lastTransferUp; ++ uint32_t m_lastTransferDown; + uint32_t m_lastHandshake; + + uint16_t m_listenPort; -- cgit v1.2.3