merged changes from RC_1_0
This commit is contained in:
@@ -162,8 +162,22 @@ if(UNIX)
|
|||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (build_tests)
|
||||||
|
# this will make some internal functions available in the
|
||||||
|
# DLL interface, for the tests to access
|
||||||
|
add_definitions(-DTORRENT_EXPORT_EXTRA)
|
||||||
|
endif (build_tests)
|
||||||
|
|
||||||
if (encryption)
|
if (encryption)
|
||||||
list(APPEND sources pe_crypto)
|
list(APPEND sources pe_crypto asio_ssl)
|
||||||
|
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
|
||||||
|
FIND_PACKAGE(OpenSSL REQUIRED)
|
||||||
|
endif()
|
||||||
|
add_definitions(-DTORRENT_USE_OPENSSL)
|
||||||
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
add_definitions(-DTORRENT_DISABLE_ENCRYPTION)
|
||||||
|
list(APPEND sources sha1)
|
||||||
endif (encryption)
|
endif (encryption)
|
||||||
|
|
||||||
if (logging)
|
if (logging)
|
||||||
@@ -239,16 +253,7 @@ if (WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (encryption)
|
if (encryption)
|
||||||
if(NOT DEFINED OPENSSL_INCLUDE_DIR OR NOT DEFINED OPENSSL_LIBRARIES)
|
|
||||||
FIND_PACKAGE(OpenSSL REQUIRED)
|
|
||||||
endif()
|
|
||||||
add_definitions(-DTORRENT_USE_OPENSSL)
|
|
||||||
list(APPEND sources asio_ssl)
|
|
||||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
||||||
target_link_libraries(torrent-rasterbar ${OPENSSL_LIBRARIES})
|
target_link_libraries(torrent-rasterbar ${OPENSSL_LIBRARIES})
|
||||||
else()
|
|
||||||
add_definitions(-DTORRENT_DISABLE_ENCRYPTION)
|
|
||||||
list(APPEND sources sha1)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT pool-allocators)
|
if (NOT pool-allocators)
|
||||||
@@ -355,8 +360,10 @@ endif()
|
|||||||
|
|
||||||
# === build tests ===
|
# === build tests ===
|
||||||
if(build_tests)
|
if(build_tests)
|
||||||
FILE(GLOB tests RELATIVE "${PROJECT_SOURCE_DIR}" "tests/*.cpp")
|
FILE(GLOB tests RELATIVE "${PROJECT_SOURCE_DIR}" "test/test_*.cpp")
|
||||||
add_library(test_common STATIC test/main.cpp test/setup_transfer.cpp)
|
add_library(test_common STATIC test/main.cpp test/setup_transfer.cpp
|
||||||
|
test/dht_server.cpp test/udp_tracker.cpp test/peer_server.cpp
|
||||||
|
test/web_seed_suite.cpp)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
foreach(s ${tests})
|
foreach(s ${tests})
|
||||||
@@ -366,9 +373,9 @@ if(build_tests)
|
|||||||
add_test(${sn} ${s})
|
add_test(${sn} ${s})
|
||||||
endforeach(s)
|
endforeach(s)
|
||||||
|
|
||||||
add_executable(test_upnp test/test_upnp.cpp)
|
# add_executable(test_upnp test/test_upnp.cpp)
|
||||||
target_link_libraries(test_upnp torrent-rasterbar)
|
# target_link_libraries(test_upnp torrent-rasterbar)
|
||||||
|
|
||||||
add_executable(test_natpmp test/test_natpmp.cpp)
|
# add_executable(test_natpmp test/test_natpmp.cpp)
|
||||||
target_link_libraries(test_natpmp torrent-rasterbar)
|
# target_link_libraries(test_natpmp torrent-rasterbar)
|
||||||
endif()
|
endif()
|
||||||
|
4
Jamfile
4
Jamfile
@@ -713,8 +713,8 @@ lib torrent
|
|||||||
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||||
<dht>logging:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
<dht>logging:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
|
||||||
|
|
||||||
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).c
|
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp
|
||||||
<dht>logging:<source>ed25519/src/$(ED25519_SOURCES).c
|
<dht>logging:<source>ed25519/src/$(ED25519_SOURCES).cpp
|
||||||
|
|
||||||
<conditional>@building
|
<conditional>@building
|
||||||
<boost>system:<cxxflags>$(CXXFLAGS)
|
<boost>system:<cxxflags>$(CXXFLAGS)
|
||||||
|
16
Makefile.am
16
Makefile.am
@@ -130,24 +130,14 @@ DOCS_PAGES = \
|
|||||||
|
|
||||||
ED25519_SOURCE = \
|
ED25519_SOURCE = \
|
||||||
ed25519/readme.md \
|
ed25519/readme.md \
|
||||||
ed25519/test.c \
|
ed25519/test.cpp \
|
||||||
ed25519/src/ed25519.h \
|
ed25519/src/ed25519.hpp \
|
||||||
ed25519/src/fe.h \
|
ed25519/src/fe.h \
|
||||||
ed25519/src/fixedint.h \
|
ed25519/src/fixedint.h \
|
||||||
ed25519/src/ge.h \
|
ed25519/src/ge.h \
|
||||||
ed25519/src/precomp_data.h \
|
ed25519/src/precomp_data.h \
|
||||||
ed25519/src/sc.h \
|
ed25519/src/sc.h \
|
||||||
ed25519/src/sha512.h \
|
ed25519/src/sha512.h
|
||||||
ed25519/src/add_scalar.c \
|
|
||||||
ed25519/src/fe.c \
|
|
||||||
ed25519/src/ge.c \
|
|
||||||
ed25519/src/key_exchange.c \
|
|
||||||
ed25519/src/keypair.c \
|
|
||||||
ed25519/src/sc.c \
|
|
||||||
ed25519/src/seed.c \
|
|
||||||
ed25519/src/sha512.c \
|
|
||||||
ed25519/src/sign.c \
|
|
||||||
ed25519/src/verify.c
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
Jamfile \
|
Jamfile \
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
#include "ge.h"
|
#include "ge.h"
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
|
|
@@ -1,7 +1,5 @@
|
|||||||
#ifndef ED25519_H
|
#ifndef ED25519_HPP
|
||||||
#define ED25519_H
|
#define ED25519_HPP
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "libtorrent/config.hpp" // for TORRENT_EXPORT
|
#include "libtorrent/config.hpp" // for TORRENT_EXPORT
|
||||||
|
|
||||||
@@ -15,9 +13,7 @@ enum
|
|||||||
ed25519_shared_secret_size = 32
|
ed25519_shared_secret_size = 32
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ED25519_NO_SEED
|
#ifndef ED25519_NO_SEED
|
||||||
int TORRENT_EXPORT ed25519_create_seed(unsigned char *seed);
|
int TORRENT_EXPORT ed25519_create_seed(unsigned char *seed);
|
||||||
@@ -29,9 +25,7 @@ int TORRENT_EXPORT ed25519_verify(const unsigned char *signature, const unsigned
|
|||||||
void TORRENT_EXPORT ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar);
|
void TORRENT_EXPORT ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar);
|
||||||
void TORRENT_EXPORT ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key);
|
void TORRENT_EXPORT ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif // ED25519_HPP
|
||||||
|
|
@@ -1,7 +1,8 @@
|
|||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
#include "fe.h"
|
#include "fe.h"
|
||||||
|
|
||||||
void ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key) {
|
void ed25519_key_exchange(unsigned char *shared_secret
|
||||||
|
, const unsigned char *public_key, const unsigned char *private_key) {
|
||||||
unsigned char e[32];
|
unsigned char e[32];
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
#include "sha512.h"
|
#include "sha512.h"
|
||||||
#include "ge.h"
|
#include "ge.h"
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
|
|
||||||
#ifndef ED25519_NO_SEED
|
#ifndef ED25519_NO_SEED
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
#include "sha512.h"
|
#include "sha512.h"
|
||||||
#include "ge.h"
|
#include "ge.h"
|
||||||
#include "sc.h"
|
#include "sc.h"
|
@@ -1,4 +1,4 @@
|
|||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
#include "sha512.h"
|
#include "sha512.h"
|
||||||
#include "ge.h"
|
#include "ge.h"
|
||||||
#include "sc.h"
|
#include "sc.h"
|
@@ -665,7 +665,9 @@ void print_usage()
|
|||||||
" options for this command:\n"
|
" options for this command:\n"
|
||||||
" -s <size> the size of the torrent in megabytes\n"
|
" -s <size> the size of the torrent in megabytes\n"
|
||||||
" -n <num-files> the number of files in the test torrent\n"
|
" -n <num-files> the number of files in the test torrent\n"
|
||||||
" -t <file> the file to save the .torrent file to\n\n"
|
" -t <file> the file to save the .torrent file to\n"
|
||||||
|
" -T <name> the name of the torrent (and directory\n"
|
||||||
|
" its files are saved in)\n\n"
|
||||||
" gen-data generate the data file(s) for the test torrent\n"
|
" gen-data generate the data file(s) for the test torrent\n"
|
||||||
" options for this command:\n"
|
" options for this command:\n"
|
||||||
" -t <file> the torrent file that was previously generated\n"
|
" -t <file> the torrent file that was previously generated\n"
|
||||||
@@ -712,7 +714,8 @@ void hasher_thread(libtorrent::create_torrent* t, int start_piece, int end_piece
|
|||||||
}
|
}
|
||||||
|
|
||||||
// size is in megabytes
|
// size is in megabytes
|
||||||
void generate_torrent(std::vector<char>& buf, int size, int num_files, char const* name)
|
void generate_torrent(std::vector<char>& buf, int size, int num_files
|
||||||
|
, char const* torrent_name)
|
||||||
{
|
{
|
||||||
file_storage fs;
|
file_storage fs;
|
||||||
// 1 MiB piece size
|
// 1 MiB piece size
|
||||||
@@ -726,7 +729,7 @@ void generate_torrent(std::vector<char>& buf, int size, int num_files, char cons
|
|||||||
while (s > 0)
|
while (s > 0)
|
||||||
{
|
{
|
||||||
char b[100];
|
char b[100];
|
||||||
snprintf(b, sizeof(b), "%s/stress_test%d", name, i);
|
snprintf(b, sizeof(b), "%s/stress_test%d", torrent_name, i);
|
||||||
++i;
|
++i;
|
||||||
fs.add_file(b, (std::min)(s, size_type(file_size)));
|
fs.add_file(b, (std::min)(s, size_type(file_size)));
|
||||||
s -= file_size;
|
s -= file_size;
|
||||||
@@ -860,7 +863,8 @@ int main(int argc, char* argv[])
|
|||||||
std::string name = filename(torrent_file);
|
std::string name = filename(torrent_file);
|
||||||
name = name.substr(0, name.find_last_of('.'));
|
name = name.substr(0, name.find_last_of('.'));
|
||||||
printf("generating torrent: %s\n", name.c_str());
|
printf("generating torrent: %s\n", name.c_str());
|
||||||
generate_torrent(tmp, size ? size : 1024, num_files ? num_files : 1, name.c_str());
|
generate_torrent(tmp, size ? size : 1024, num_files ? num_files : 1
|
||||||
|
, name.c_str());
|
||||||
|
|
||||||
FILE* output = stdout;
|
FILE* output = stdout;
|
||||||
if (strcmp("-", torrent_file) != 0)
|
if (strcmp("-", torrent_file) != 0)
|
||||||
|
@@ -17,16 +17,16 @@ KADEMLIA_SOURCES = \
|
|||||||
kademlia/get_peers.cpp \
|
kademlia/get_peers.cpp \
|
||||||
kademlia/get_item.cpp \
|
kademlia/get_item.cpp \
|
||||||
kademlia/item.cpp \
|
kademlia/item.cpp \
|
||||||
../ed25519/src/add_scalar.c \
|
../ed25519/src/add_scalar.cpp \
|
||||||
../ed25519/src/fe.c \
|
../ed25519/src/fe.cpp \
|
||||||
../ed25519/src/ge.c \
|
../ed25519/src/ge.cpp \
|
||||||
../ed25519/src/key_exchange.c \
|
../ed25519/src/key_exchange.cpp \
|
||||||
../ed25519/src/keypair.c \
|
../ed25519/src/keypair.cpp \
|
||||||
../ed25519/src/sc.c \
|
../ed25519/src/sc.cpp \
|
||||||
../ed25519/src/seed.c \
|
../ed25519/src/seed.cpp \
|
||||||
../ed25519/src/sha512.c \
|
../ed25519/src/sha512.cpp \
|
||||||
../ed25519/src/sign.c \
|
../ed25519/src/sign.cpp \
|
||||||
../ed25519/src/verify.c
|
../ed25519/src/verify.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if WITH_SHIPPED_GEOIP
|
if WITH_SHIPPED_GEOIP
|
||||||
|
@@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <libtorrent/kademlia/item.hpp>
|
#include <libtorrent/kademlia/item.hpp>
|
||||||
#include <libtorrent/bencode.hpp>
|
#include <libtorrent/bencode.hpp>
|
||||||
|
|
||||||
#include "ed25519.h"
|
#include "ed25519.hpp"
|
||||||
|
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
#include "libtorrent/lazy_entry.hpp"
|
#include "libtorrent/lazy_entry.hpp"
|
||||||
|
@@ -128,17 +128,7 @@ libtest_la_SOURCES = main.cpp \
|
|||||||
dht_server.cpp \
|
dht_server.cpp \
|
||||||
udp_tracker.cpp \
|
udp_tracker.cpp \
|
||||||
peer_server.cpp \
|
peer_server.cpp \
|
||||||
web_seed_suite.cpp \
|
web_seed_suite.cpp
|
||||||
../ed25519/src/add_scalar.c \
|
|
||||||
../ed25519/src/fe.c \
|
|
||||||
../ed25519/src/ge.c \
|
|
||||||
../ed25519/src/key_exchange.c \
|
|
||||||
../ed25519/src/keypair.c \
|
|
||||||
../ed25519/src/sc.c \
|
|
||||||
../ed25519/src/seed.c \
|
|
||||||
../ed25519/src/sha512.c \
|
|
||||||
../ed25519/src/sign.c \
|
|
||||||
../ed25519/src/verify.c
|
|
||||||
|
|
||||||
test_bitfield_SOURCES = test_bitfield.cpp
|
test_bitfield_SOURCES = test_bitfield.cpp
|
||||||
test_connection_queue_SOURCES = test_connection_queue.cpp
|
test_connection_queue_SOURCES = test_connection_queue.cpp
|
||||||
|
@@ -77,7 +77,9 @@ struct test_storage : default_storage
|
|||||||
, m_written(0)
|
, m_written(0)
|
||||||
, m_limit(16 * 1024 * 2)
|
, m_limit(16 * 1024 * 2)
|
||||||
{}
|
{}
|
||||||
virtual void set_file_priority(std::vector<boost::uint8_t> const& p) {}
|
|
||||||
|
virtual void set_file_priority(std::vector<boost::uint8_t> const& p
|
||||||
|
, storage_error& ec) {}
|
||||||
|
|
||||||
void set_limit(int lim)
|
void set_limit(int lim)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user