From 2e0d50407bdc20a3451e447f9aceccd7c3b77a4e Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 1 Oct 2007 08:46:09 +0000 Subject: [PATCH] lt sync 1623 --- libtorrent/include/libtorrent/debug.hpp | 15 +++++++++++---- libtorrent/include/libtorrent/time.hpp | 1 - libtorrent/src/peer_connection.cpp | 1 - libtorrent/src/torrent.cpp | 2 ++ libtorrent/src/torrent_handle.cpp | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libtorrent/include/libtorrent/debug.hpp b/libtorrent/include/libtorrent/debug.hpp index 1bb645a8e..41e08b28d 100755 --- a/libtorrent/include/libtorrent/debug.hpp +++ b/libtorrent/include/libtorrent/debug.hpp @@ -60,10 +60,17 @@ namespace libtorrent { logger(fs::path const& filename, int instance, bool append = true) { - fs::path dir(fs::complete("libtorrent_logs" + boost::lexical_cast(instance))); - if (!fs::exists(dir)) fs::create_directories(dir); - m_file.open((dir / filename).string().c_str(), std::ios_base::out | (append ? std::ios_base::app : std::ios_base::out)); - *this << "\n\n\n*** starting log ***\n"; + try + { + fs::path dir(fs::complete("libtorrent_logs" + boost::lexical_cast(instance))); + if (!fs::exists(dir)) fs::create_directories(dir); + m_file.open((dir / filename).string().c_str(), std::ios_base::out | (append ? std::ios_base::app : std::ios_base::out)); + *this << "\n\n\n*** starting log ***\n"; + } + catch (std::exception& e) + { + std::cerr << "failed to create log '" << filename << "': " << e.what() << std::endl; + } } template diff --git a/libtorrent/include/libtorrent/time.hpp b/libtorrent/include/libtorrent/time.hpp index 6c31b6df8..d3470c89d 100644 --- a/libtorrent/include/libtorrent/time.hpp +++ b/libtorrent/include/libtorrent/time.hpp @@ -394,4 +394,3 @@ namespace libtorrent #endif - diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index 5ef96ec5b..a4d66f79c 100755 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -3030,4 +3030,3 @@ namespace libtorrent } } - diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index e9b2cd79e..08176c6e0 100755 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -775,6 +775,8 @@ namespace libtorrent if (total_done >= m_torrent_file->total_size()) { + // Thist happens when a piece has been downloaded completely + // but not yet verified against the hash std::copy(m_have_pieces.begin(), m_have_pieces.end() , std::ostream_iterator(std::cerr, " ")); std::cerr << std::endl; diff --git a/libtorrent/src/torrent_handle.cpp b/libtorrent/src/torrent_handle.cpp index ebef802a8..7a4a24470 100755 --- a/libtorrent/src/torrent_handle.cpp +++ b/libtorrent/src/torrent_handle.cpp @@ -363,7 +363,7 @@ namespace libtorrent aux::piece_checker_data* d = m_chk->find_torrent(m_info_hash); if (d != 0) { - torrent_status st; + torrent_status st = d->torrent_ptr->status(); if (d->processing) {