forked from premiere/premiere-libtorrent
parent
717ed8bd3b
commit
15bac1e9b5
81
.travis.yml
81
.travis.yml
|
@ -1,14 +1,20 @@
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
os:
|
matrix:
|
||||||
- linux
|
include:
|
||||||
- osx
|
- env: variant=test_release coverage=1
|
||||||
|
- env: variant=test_debug sim=1
|
||||||
env:
|
- env: variant=test_barebones
|
||||||
- variant=test_release coverage=1 docs=1
|
- env: analyze=1
|
||||||
- variant=test_debug sim=1
|
- os: osx
|
||||||
- variant=test_barebones
|
osx_image: xcode6.4
|
||||||
- analyze=1
|
env: variant=test_release docs=1
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode6.4
|
||||||
|
env: variant=test_debug
|
||||||
|
- os: osx
|
||||||
|
osx_image: xcode6.4
|
||||||
|
env: variant=test_barebones
|
||||||
|
|
||||||
git:
|
git:
|
||||||
submodules: false
|
submodules: false
|
||||||
|
@ -43,7 +49,7 @@ before_install:
|
||||||
|
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
- 'if [[ $TRAVIS_OS_NAME == "osx" && "$variant" != "" ]]; then brew update > /dev/null && brew install --quiet ccache boost-build boost-python; fi'
|
- 'if [[ $TRAVIS_OS_NAME == "osx" && "$variant" != "" ]]; then brew update > /dev/null && brew install --quiet ccache boost-build boost-python; fi'
|
||||||
- 'if [[ $TRAVIS_OS_NAME == "osx" && "$docs" = "1" ]]; then
|
- 'if [ "$docs" = "1" ]; then
|
||||||
brew install --quiet https://raw.githubusercontent.com/catap/homebrew/docutils/Library/Formula/docutils.rb;
|
brew install --quiet https://raw.githubusercontent.com/catap/homebrew/docutils/Library/Formula/docutils.rb;
|
||||||
mkdir -p /Users/travis/Library/Python/2.7/lib/python/site-packages;
|
mkdir -p /Users/travis/Library/Python/2.7/lib/python/site-packages;
|
||||||
echo ''import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")'' >> /Users/travis/Library/Python/2.7/lib/python/site-packages/homebrew.pth;
|
echo ''import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")'' >> /Users/travis/Library/Python/2.7/lib/python/site-packages/homebrew.pth;
|
||||||
|
@ -57,7 +63,7 @@ before_install:
|
||||||
- if [ $TRAVIS_OS_NAME == "osx" ]; then export toolset="darwin"; export sim="0"; fi
|
- if [ $TRAVIS_OS_NAME == "osx" ]; then export toolset="darwin"; export sim="0"; fi
|
||||||
- if [ $TRAVIS_OS_NAME == "osx" ]; then export target="osx-tests"; fi
|
- if [ $TRAVIS_OS_NAME == "osx" ]; then export target="osx-tests"; fi
|
||||||
- if [ $TRAVIS_OS_NAME == "linux" ]; then export toolset="gcc"; fi
|
- if [ $TRAVIS_OS_NAME == "linux" ]; then export toolset="gcc"; fi
|
||||||
- if [[ $TRAVIS_OS_NAME == "linux" && "$coverage" == "1" ]]; then
|
- if [ "$coverage" == "1" ]; then
|
||||||
export toolset=gcc-coverage;
|
export toolset=gcc-coverage;
|
||||||
pip install --user codecov;
|
pip install --user codecov;
|
||||||
fi
|
fi
|
||||||
|
@ -78,13 +84,13 @@ install:
|
||||||
- 'echo "using darwin : : ccache clang++ : <cflags>-std=c11 <cxxflags>-std=c++11 <compileflags>-Wno-deprecated-declarations ;" >> ~/user-config.jam'
|
- 'echo "using darwin : : ccache clang++ : <cflags>-std=c11 <cxxflags>-std=c++11 <compileflags>-Wno-deprecated-declarations ;" >> ~/user-config.jam'
|
||||||
- 'echo "using python : 2.7 ;" >> ~/user-config.jam'
|
- 'echo "using python : 2.7 ;" >> ~/user-config.jam'
|
||||||
- 'if [[ "$variant" != "" ]]; then ccache -V && ccache --show-stats && ccache --zero-stats; fi'
|
- 'if [[ "$variant" != "" ]]; then ccache -V && ccache --show-stats && ccache --zero-stats; fi'
|
||||||
- if [[ "$docs" == "1" && $TRAVIS_OS_NAME == "osx" ]]; then rst2html.py --version; fi
|
- if [ "$docs" == "1" ]; then rst2html.py --version; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|
||||||
|
|
||||||
- cd docs
|
- cd docs
|
||||||
- 'if [[ "$docs" == "1" && $TRAVIS_OS_NAME == "osx" ]]; then
|
- 'if [ "$docs" == "1" ]; then
|
||||||
make RST2HTML=rst2html.py;
|
make RST2HTML=rst2html.py;
|
||||||
fi'
|
fi'
|
||||||
- cd ..
|
- cd ..
|
||||||
|
@ -94,7 +100,7 @@ script:
|
||||||
- cd test
|
- cd test
|
||||||
- 'if [ "$variant" != "" ]; then
|
- 'if [ "$variant" != "" ]; then
|
||||||
bjam -j3 warnings-as-errors=on variant=$variant -l900 $toolset $target &&
|
bjam -j3 warnings-as-errors=on variant=$variant -l900 $toolset $target &&
|
||||||
if [[ $TRAVIS_OS_NAME == "linux" && "$coverage" == "1" ]]; then
|
if [ "$coverage" == "1" ]; then
|
||||||
codecov --root .. --gcov-exec gcov-5;
|
codecov --root .. --gcov-exec gcov-5;
|
||||||
fi;
|
fi;
|
||||||
fi'
|
fi'
|
||||||
|
@ -135,32 +141,27 @@ script:
|
||||||
|
|
||||||
# run cppcheck if enabled
|
# run cppcheck if enabled
|
||||||
- 'if [[ "$analyze" == "1" ]]; then
|
- 'if [[ "$analyze" == "1" ]]; then
|
||||||
if [[ $TRAVIS_OS_NAME == "linux" ]]; then
|
cppcheck --version &&
|
||||||
cppcheck --version &&
|
find src test examples tools -type f | grep ".*\.cpp$" >cppcheck.files &&
|
||||||
find src test examples tools -type f | grep ".*\.cpp$" >cppcheck.files &&
|
find simulation -type f -depth -2 | grep ".*\.cpp$" >>cppcheck.files &&
|
||||||
find simulation -type f -depth -2 | grep ".*\.cpp$" >>cppcheck.files &&
|
cppcheck -DTORRENT_USE_IPV6="1" -DTORRENT_USE_I2P="1"
|
||||||
cppcheck -DTORRENT_USE_IPV6="1" -DTORRENT_USE_I2P="1"
|
-DTORRENT_USE_OPENSSL="1" -DTORRENT_USE_INVARIANT_CHECKS="1"
|
||||||
-DTORRENT_USE_OPENSSL="1" -DTORRENT_USE_INVARIANT_CHECKS="1"
|
-DTORRENT_EXPENSIVE_INVARIANT_CHECKS="1" -DTORRENT_USE_ASSERTS="1"
|
||||||
-DTORRENT_EXPENSIVE_INVARIANT_CHECKS="1" -DTORRENT_USE_ASSERTS="1"
|
-UTORRENT_DISABLE_MUTABLE_TORRENTS -UTORRENT_DISABLE_LOGGING
|
||||||
-UTORRENT_DISABLE_MUTABLE_TORRENTS -UTORRENT_DISABLE_LOGGING
|
-UTORRENT_DEBUG_BUFFERS -UTORRENT_EXPORT_EXTRA
|
||||||
-UTORRENT_DEBUG_BUFFERS -UTORRENT_EXPORT_EXTRA
|
--suppress=preprocessorErrorDirective
|
||||||
--suppress=preprocessorErrorDirective
|
--suppress=noConstructor
|
||||||
--suppress=noConstructor
|
--suppress=syntaxError
|
||||||
--suppress=syntaxError
|
--enable=style
|
||||||
--enable=style
|
--template "{file}({line}): {severity} ({id}): {message}"
|
||||||
--template "{file}({line}): {severity} ({id}): {message}"
|
--inline-suppr --force --std=c++11 -j2 -I include -I /usr/local/include
|
||||||
--inline-suppr --force --std=c++11 -j2 -I include -I /usr/local/include
|
--file-list=cppcheck.files 2> cppcheck.txt;
|
||||||
--file-list=cppcheck.files 2> cppcheck.txt;
|
if [ -s cppcheck.txt ]; then
|
||||||
if [ -s cppcheck.txt ]; then
|
echo " ======= CPPCHECK ERRORS =====";
|
||||||
echo " ======= CPPCHECK ERRORS =====";
|
cat cppcheck.txt;
|
||||||
cat cppcheck.txt;
|
exit 1;
|
||||||
exit 1;
|
fi;
|
||||||
fi;
|
fi'
|
||||||
fi;
|
|
||||||
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
|
||||||
echo "nothing here yet";
|
|
||||||
fi;
|
|
||||||
fi'
|
|
||||||
|
|
||||||
- 'if [[ "$variant" != "" ]]; then ccache --show-stats; fi'
|
- 'if [[ "$variant" != "" ]]; then ccache --show-stats; fi'
|
||||||
|
|
||||||
|
|
|
@ -275,8 +275,6 @@ endif()
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
# this works around a bug in asio in boost-1.39
|
|
||||||
add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 )
|
|
||||||
add_definitions(-DBOOST_ASIO_HAS_STD_CHRONO=1 )
|
add_definitions(-DBOOST_ASIO_HAS_STD_CHRONO=1 )
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
|
3
Jamfile
3
Jamfile
|
@ -491,6 +491,7 @@ variant test_release : release
|
||||||
: <asserts>production <debug-symbols>on
|
: <asserts>production <debug-symbols>on
|
||||||
<invariant-checks>full <boost-link>shared <optimization>off
|
<invariant-checks>full <boost-link>shared <optimization>off
|
||||||
<export-extra>on <debug-iterators>on <threading>multi
|
<export-extra>on <debug-iterators>on <threading>multi
|
||||||
|
<inlining>off
|
||||||
;
|
;
|
||||||
variant test_debug : debug
|
variant test_debug : debug
|
||||||
: <crypto>openssl <logging>on <disk-stats>on
|
: <crypto>openssl <logging>on <disk-stats>on
|
||||||
|
@ -703,8 +704,6 @@ local usage-requirements =
|
||||||
<define>BOOST_ASIO_ENABLE_CANCELIO
|
<define>BOOST_ASIO_ENABLE_CANCELIO
|
||||||
# make sure asio uses std::chrono
|
# make sure asio uses std::chrono
|
||||||
<define>BOOST_ASIO_HAS_STD_CHRONO
|
<define>BOOST_ASIO_HAS_STD_CHRONO
|
||||||
# this works around a bug in asio in boost-1.39
|
|
||||||
<define>BOOST_ASIO_HASH_MAP_BUCKETS=1021
|
|
||||||
<conditional>@linking
|
<conditional>@linking
|
||||||
# these compiler settings just makes the compiler standard conforming
|
# these compiler settings just makes the compiler standard conforming
|
||||||
<toolset>msvc:<cflags>/Zc:wchar_t
|
<toolset>msvc:<cflags>/Zc:wchar_t
|
||||||
|
|
|
@ -79,10 +79,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
# define TORRENT_DEPRECATED __attribute__ ((deprecated))
|
# define TORRENT_DEPRECATED __attribute__ ((deprecated))
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8)
|
|
||||||
# define TORRENT_NO_ATOMIC_DURATION 1
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// ======= SUNPRO =========
|
// ======= SUNPRO =========
|
||||||
|
|
||||||
#elif defined __SUNPRO_CC
|
#elif defined __SUNPRO_CC
|
||||||
|
@ -93,9 +89,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#elif defined BOOST_MSVC
|
#elif defined BOOST_MSVC
|
||||||
|
|
||||||
#pragma warning(disable: 4258)
|
|
||||||
#pragma warning(disable: 4251)
|
|
||||||
|
|
||||||
// class X needs to have dll-interface to be used by clients of class Y
|
// class X needs to have dll-interface to be used by clients of class Y
|
||||||
#pragma warning(disable:4251)
|
#pragma warning(disable:4251)
|
||||||
|
|
||||||
|
@ -439,12 +432,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_NO_FPU 0
|
#define TORRENT_NO_FPU 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// defined to 1 if the compiler does not support putting
|
|
||||||
// std::chrono::time_point in a std::atomic (which it's supposed to)
|
|
||||||
#ifndef TORRENT_NO_ATOMIC_DURATION
|
|
||||||
#define TORRENT_NO_ATOMIC_DURATION 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TORRENT_USE_IOSTREAM
|
#ifndef TORRENT_USE_IOSTREAM
|
||||||
#ifndef BOOST_NO_IOSTREAM
|
#ifndef BOOST_NO_IOSTREAM
|
||||||
#define TORRENT_USE_IOSTREAM 1
|
#define TORRENT_USE_IOSTREAM 1
|
||||||
|
|
|
@ -361,7 +361,7 @@ namespace libtorrent
|
||||||
void set_share_mode(bool s);
|
void set_share_mode(bool s);
|
||||||
bool share_mode() const { return m_share_mode; }
|
bool share_mode() const { return m_share_mode; }
|
||||||
|
|
||||||
// TOOD: make graceful pause also finish all sending blocks
|
// TODO: make graceful pause also finish all sending blocks
|
||||||
// before disconnecting
|
// before disconnecting
|
||||||
bool graceful_pause() const { return m_graceful_pause_mode; }
|
bool graceful_pause() const { return m_graceful_pause_mode; }
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace libtorrent
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// this is the constructor where the we are the active part.
|
// this is the constructor where the we are the active part.
|
||||||
// The peer_conenction should handshake and verify that the
|
// The peer_connection should handshake and verify that the
|
||||||
// other end has the correct id
|
// other end has the correct id
|
||||||
web_peer_connection(peer_connection_args const& pack
|
web_peer_connection(peer_connection_args const& pack
|
||||||
, web_seed_t& web);
|
, web_seed_t& web);
|
||||||
|
|
|
@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "libtorrent/aux_/cpuid.hpp"
|
#include "libtorrent/aux_/cpuid.hpp"
|
||||||
|
|
||||||
#if defined _MSC_VER && TORRENT_HAS_SSE
|
#if defined _MSC_VER && TORRENT_HAS_SSE
|
||||||
|
@ -89,5 +87,3 @@ namespace libtorrent { namespace aux
|
||||||
bool sse42_support = supports_sse42();
|
bool sse42_support = supports_sse42();
|
||||||
bool mmx_support = supports_mmx();
|
bool mmx_support = supports_mmx();
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/socket_type.hpp"
|
#include "libtorrent/socket_type.hpp"
|
||||||
#include "libtorrent/utp_socket_manager.hpp"
|
#include "libtorrent/utp_socket_manager.hpp"
|
||||||
#include "libtorrent/instantiate_connection.hpp"
|
#include "libtorrent/instantiate_connection.hpp"
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
11
src/time.cpp
11
src/time.cpp
|
@ -30,7 +30,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libtorrent/time.hpp"
|
|
||||||
#include "libtorrent/aux_/time.hpp"
|
#include "libtorrent/aux_/time.hpp"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
|
@ -39,20 +38,10 @@ namespace libtorrent { namespace aux
|
||||||
// used to cache the current time regularly (update_time_now() is called by
|
// used to cache the current time regularly (update_time_now() is called by
|
||||||
// the session_impl main thread). This is cheaper than a system call and can
|
// the session_impl main thread). This is cheaper than a system call and can
|
||||||
// be used where more accurate time is not necessary
|
// be used where more accurate time is not necessary
|
||||||
#if !TORRENT_NO_ATOMIC_DURATION
|
|
||||||
namespace {
|
namespace {
|
||||||
std::atomic<time_point> g_current_time(clock_type::now());
|
std::atomic<time_point> g_current_time(clock_type::now());
|
||||||
}
|
}
|
||||||
time_point time_now() { return aux::g_current_time.load(); }
|
time_point time_now() { return aux::g_current_time.load(); }
|
||||||
void update_time_now() { g_current_time.store(clock_type::now()); }
|
void update_time_now() { g_current_time.store(clock_type::now()); }
|
||||||
#else
|
|
||||||
// work-around for not being able to put time_point in std::atomic
|
|
||||||
namespace {
|
|
||||||
std::atomic<time_duration::rep> g_current_time(clock_type::now().time_since_epoch().count());
|
|
||||||
}
|
|
||||||
time_point time_now() { return time_point(clock_type::duration(aux::g_current_time.load())); }
|
|
||||||
void update_time_now() { g_current_time.store(clock_type::now().time_since_epoch().count()); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue