From a28ed1c96bcc39a5f01e85698234ff7601aef9a5 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sat, 27 Aug 2005 15:44:56 +0000 Subject: [PATCH] * File progress wasn't being updated as the index range iterator was off by one. * Removed ProtocolChunk, moved the functions to PeerConnectionBase, remains to clean it up. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@546 e378c898-3ddf-0310-93e7-cc216c733640 --- src/core/download.cc | 12 +++++++++--- src/core/download.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/download.cc b/src/core/download.cc index 05041eb5..10ed7522 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -53,9 +53,9 @@ Download::Download() : void Download::start() { if (is_done()) - m_download.set_connection_type(m_connectionSeed); + m_download.set_connection_type(string_to_connection_type(m_connectionSeed)); else - m_download.set_connection_type(m_connectionLeech); + m_download.set_connection_type(string_to_connection_type(m_connectionLeech)); m_download.start(); } @@ -97,7 +97,7 @@ Download::release_download() { void Download::receive_finished() { - m_download.set_connection_type(m_connectionSeed); + m_download.set_connection_type(string_to_connection_type(m_connectionSeed)); } void @@ -113,4 +113,10 @@ Download::receive_storage_error(std::string msg) { m_message = "Storage error: [" + msg + "]"; } +torrent::Download::ConnectionType +Download::string_to_connection_type(const std::string& name) { + // Return default if the name isn't found. + return torrent::Download::CONNECTION_DEFAULT; +} + } diff --git a/src/core/download.h b/src/core/download.h index 59ef0964..fcaedf1d 100644 --- a/src/core/download.h +++ b/src/core/download.h @@ -86,6 +86,8 @@ private: void receive_tracker_msg(std::string msg); void receive_storage_error(std::string msg); + static torrent::Download::ConnectionType string_to_connection_type(const std::string& name); + torrent::Download m_download; std::string m_message;