prepared for precompiled headers support. fixed issue where storage didn't lock the session properly. fixed typo in natpmp.cpp

This commit is contained in:
Arvid Norberg 2007-03-17 17:15:16 +00:00
parent 4ac08f393a
commit 8957b64c04
44 changed files with 204 additions and 20 deletions

View File

@ -4,6 +4,7 @@ import modules ;
import os ;
import errors ;
import feature : feature ;
#import pch ;
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
@ -157,11 +158,14 @@ project torrent
;
#cpp-pch pch : include/libtorrent/pch.hpp ;
lib torrent
:
src/$(SOURCES)
zlib/$(ZLIB_SOURCES)
$(LIBS)
# pch
:
<dht-support>on:<source>src/$(KADEMLIA_SOURCES)
<dht-support>logging:<source>src/$(KADEMLIA_SOURCES)

View File

@ -23,6 +23,7 @@ libtorrent/peer_connection.hpp \
libtorrent/bt_peer_connection.hpp \
libtorrent/web_peer_connection.hpp \
libtorrent/natpmp.hpp \
libtorrent/pch.hpp \
libtorrent/peer_id.hpp \
libtorrent/peer_info.hpp \
libtorrent/peer_request.hpp \

View File

@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_id.hpp"
#include "libtorrent/config.hpp"
#include "zlib.h"
// from sha1.cpp
struct TORRENT_EXPORT SHA1_CTX
@ -51,12 +52,6 @@ TORRENT_EXPORT void SHA1Init(SHA1_CTX* context);
TORRENT_EXPORT void SHA1Update(SHA1_CTX* context, boost::uint8_t const* data, boost::uint32_t len);
TORRENT_EXPORT void SHA1Final(SHA1_CTX* context, boost::uint8_t* digest);
extern "C"
{
// from zlib/adler32.c
unsigned long adler32(unsigned long adler, const char* data, unsigned int len);
}
namespace libtorrent
{
@ -69,7 +64,7 @@ namespace libtorrent
{
assert(data != 0);
assert(len > 0);
m_adler = adler32(m_adler, data, len);
m_adler = adler32(m_adler, (const Bytef*)data, len);
}
unsigned long final() const { return m_adler; }
void reset() { m_adler = adler32(0, 0, 0); }

View File

@ -0,0 +1,96 @@
#ifdef BOOST_BUILD_PCH_ENABLED
#include <algorithm>
#include <asio/ip/host_name.hpp>
#include <assert.h>
#include <bitset>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/detail/atomic_count.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/function.hpp>
#include <boost/integer_traits.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator_adaptors.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/limits.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/next_prior.hpp>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/ref.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/static_assert.hpp>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility.hpp>
#include <boost/version.hpp>
#include <boost/weak_ptr.hpp>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cwchar>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <typeinfo>
#include <utility>
#include <vector>
#include <zlib.h>
#ifdef __OBJC__
#define Protocol Protocol_
#endif
#include <asio/ip/tcp.hpp>
#include <asio/ip/udp.hpp>
#include <asio/io_service.hpp>
#include <asio/deadline_timer.hpp>
#include <asio/write.hpp>
#include <asio/strand.hpp>
#ifdef __OBJC__
#undef Protocol
#endif
#endif

View File

@ -126,7 +126,7 @@ namespace libtorrent
bool check_fastresume(aux::piece_checker_data& d
, std::vector<bool>& pieces, int& num_pieces, bool compact_mode);
std::pair<bool, float> check_files(std::vector<bool>& pieces
, int& num_pieces);
, int& num_pieces, boost::recursive_mutex& mutex);
void release_files();

View File

@ -51,6 +51,7 @@ $(top_srcdir)/include/libtorrent/peer_connection.hpp \
$(top_srcdir)/include/libtorrent/bt_peer_connection.hpp \
$(top_srcdir)/include/libtorrent/web_peer_connection.hpp \
$(top_srcdir)/include/libtorrent/natpmp.hpp \
$(top_srcdir)/include/libtorrent/pch.hpp \
$(top_srcdir)/include/libtorrent/peer_id.hpp \
$(top_srcdir)/include/libtorrent/peer_info.hpp \
$(top_srcdir)/include/libtorrent/peer_request.hpp \

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include "libtorrent/alert.hpp"
namespace libtorrent {

View File

@ -42,6 +42,8 @@ POSSIBILITY OF SUCH DAMAGE.
//generation of the min and max macros in Visual C++, #define
//NOMINMAX before #including <windows.h>.
#include "libtorrent/pch.hpp"
#ifdef _WIN32
//support boost1.32.0(2004-11-19 18:47)
//now all libs can be compiled and linked with static module

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include "libtorrent/invariant_check.hpp"
#include "libtorrent/bandwidth_manager.hpp"
#include "libtorrent/peer_connection.hpp"

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <iomanip>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <algorithm>
#include <iomanip>
#include "libtorrent/entry.hpp"

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <string>
#include <cassert>
#include <stdexcept>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#ifdef _WIN32
// windows part
#include "libtorrent/utf8.hpp"

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include "libtorrent/file_pool.hpp"
#include <iostream>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <cctype>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <cctype>
#include <algorithm>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include "libtorrent/ip_filter.hpp"
#include <boost/utility.hpp>
//#include <iostream>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <libtorrent/kademlia/closest_nodes.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <fstream>
#include <set>
#include <numeric>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <libtorrent/kademlia/find_data.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <utility>
#include <boost/bind.hpp>
#include <boost/optional.hpp>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <algorithm>
#include <iomanip>
#include <cassert>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <libtorrent/kademlia/refresh.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <deque>
#include <algorithm>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <boost/bind.hpp>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <libtorrent/kademlia/traversal_algorithm.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/rpc_manager.hpp>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <libtorrent/natpmp.hpp>
#include <libtorrent/io.hpp>
#include <boost/bind.hpp>
@ -302,7 +304,7 @@ void natpmp::on_reply(asio::error_code const& e
case 2: errmsg << "Not authorized to create port map (enable NAT-PMP on your router)"; break;
case 3: errmsg << "Network failure"; break;
case 4: errmsg << "Out of resources"; break;
case 5: errmsg << "Unsupported opcpde"; break;
case 5: errmsg << "Unsupported opcode"; break;
}
throw std::runtime_error(errmsg.str());
}

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <iomanip>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <cmath>
#include <algorithm>

View File

@ -30,9 +30,9 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include <iostream>
#include "libtorrent/pch.hpp"
#include "libtorrent/peer_connection.hpp"
#include <iostream>
#ifdef _MSC_VER
#pragma warning(push, 1)
@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE.
#pragma warning(pop)
#endif
#include "libtorrent/peer_connection.hpp"
#include "libtorrent/web_peer_connection.hpp"
#include "libtorrent/policy.hpp"
#include "libtorrent/torrent.hpp"

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <ctime>
#include <iostream>
#include <fstream>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <ctime>
#include <iostream>
#include <fstream>

View File

@ -10,6 +10,8 @@ By Steve Reid <sreid@sea-to-sky.net>
changelog at the end of the file.
*/
#include "libtorrent/pch.hpp"
#include <cstdio>
#include <cstring>

View File

@ -35,11 +35,13 @@ POSSIBILITY OF SUCH DAMAGE.
// per second and one (low pass-filter) for rates < 1
// packet per second.
#include "libtorrent/pch.hpp"
#include <numeric>
#include <algorithm>
#include "libtorrent/stat.hpp"
#include "libtorrent/invariant_check.hpp"
#include <algorithm>
#if defined _MSC_VER && _MSC_VER <= 1200
#define for if (false) {} else for

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <ctime>
#include <iterator>
#include <algorithm>
@ -716,7 +718,7 @@ namespace libtorrent
std::pair<bool, float> check_files(
std::vector<bool>& pieces
, int& num_pieces);
, int& num_pieces, boost::recursive_mutex& mutex);
void release_files();
@ -764,7 +766,8 @@ namespace libtorrent
, int current_slot
, std::vector<bool>& have_pieces
, int& num_pieces
, const std::multimap<sha1_hash, int>& hash_to_piece);
, const std::multimap<sha1_hash, int>& hash_to_piece
, boost::recursive_mutex& mutex);
int allocate_slot_for_piece(int piece_index);
#ifndef NDEBUG
@ -1063,7 +1066,8 @@ namespace libtorrent
, int current_slot
, std::vector<bool>& have_pieces
, int& num_pieces
, const std::multimap<sha1_hash, int>& hash_to_piece)
, const std::multimap<sha1_hash, int>& hash_to_piece
, boost::recursive_mutex& mutex)
{
// INVARIANT_CHECK;
@ -1123,6 +1127,9 @@ namespace libtorrent
{
const int piece_index = current_slot;
// lock because we're writing to have_pieces
boost::recursive_mutex::scoped_lock l(mutex);
if (have_pieces[piece_index])
{
// we have already found a piece with
@ -1192,6 +1199,9 @@ namespace libtorrent
if (free_piece >= 0)
{
// lock because we're writing to have_pieces
boost::recursive_mutex::scoped_lock l(mutex);
assert(have_pieces[free_piece] == false);
assert(m_piece_to_slot[free_piece] == has_no_slot);
have_pieces[free_piece] = true;
@ -1304,7 +1314,7 @@ namespace libtorrent
// file check is at. 0 is nothing done, and 1
// is finished
std::pair<bool, float> piece_manager::impl::check_files(
std::vector<bool>& pieces, int& num_pieces)
std::vector<bool>& pieces, int& num_pieces, boost::recursive_mutex& mutex)
{
assert(num_pieces == std::count(pieces.begin(), pieces.end(), true));
@ -1395,7 +1405,8 @@ namespace libtorrent
, m_current_slot
, pieces
, num_pieces
, m_hash_to_piece);
, m_hash_to_piece
, mutex);
assert(num_pieces == std::count(pieces.begin(), pieces.end(), true));
assert(piece_index == unassigned || piece_index >= 0);
@ -1664,9 +1675,10 @@ namespace libtorrent
std::pair<bool, float> piece_manager::check_files(
std::vector<bool>& pieces
, int& num_pieces)
, int& num_pieces
, boost::recursive_mutex& mutex)
{
return m_pimpl->check_files(pieces, num_pieces);
return m_pimpl->check_files(pieces, num_pieces, mutex);
}
int piece_manager::impl::allocate_slot_for_piece(int piece_index)

View File

@ -29,6 +29,9 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <ctime>
#include <iostream>
#include <fstream>
@ -2099,7 +2102,8 @@ namespace libtorrent
std::pair<bool, float> progress(true, 1.f);
try
{
progress = m_storage->check_files(m_have_pieces, m_num_pieces);
progress = m_storage->check_files(m_have_pieces, m_num_pieces
, m_ses.m_mutex);
}
catch (std::exception& e)
{

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <ctime>
#include <iostream>
#include <fstream>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <ctime>
#include <iostream>
#include <fstream>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <cctype>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <cctype>

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif

View File

@ -30,6 +30,8 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/pch.hpp"
#include <vector>
#include <iostream>
#include <iomanip>