Skip to content

Commit 60b74d2

Browse files
author
Arvid Norberg
committed
merged RC_1_1 into master
2 parents 0c6b17e + a952455 commit 60b74d2

18 files changed

+173
-110
lines changed

Jamfile

+45-65
Original file line numberDiff line numberDiff line change
@@ -45,59 +45,6 @@ else
4545

4646
VERSION = 1.2.0 ;
4747

48-
# rule for linking the correct libraries depending
49-
# on features and target-os
50-
rule link-openssl ( properties * )
51-
{
52-
local result ;
53-
54-
# openssl libraries, if enabled
55-
# exclude gcc from a regular windows build to make mingw
56-
# link against the regular unix library name
57-
if <openssl-version>pre1.1 in $(properties)
58-
&& <target-os>windows in $(properties)
59-
&& ! <toolset>gcc in $(properties)
60-
{
61-
result += <library>ssleay32 <library>libeay32 ;
62-
}
63-
else
64-
{
65-
# on windows the library names were changed to be in line with other
66-
# system starting with OpenSSL 1.1
67-
result += <library>crypto <library>ssl ;
68-
}
69-
70-
if <crypto>libcrypto in $(properties)
71-
{
72-
# exclude gcc from a regular windows build to make mingw
73-
# link against the regular unix library name
74-
if <openssl-version>pre1.1 in $(properties)
75-
&& <target-os>windows in $(properties)
76-
&& ! <toolset>gcc in $(properties)
77-
{
78-
# it should be possible to cleanup this list, but this is safe for now
79-
result += <library>libeay32 ;
80-
}
81-
else
82-
{
83-
result += <library>crypto ;
84-
}
85-
}
86-
87-
# windows needs some more libraries when using openSSL
88-
if <target-os>windows in $(properties)
89-
&& ! <toolset>gcc in $(properties)
90-
{
91-
result += <library>advapi32
92-
<library>user32
93-
<library>shell32
94-
<library>gdi32
95-
;
96-
}
97-
echo "link openssl = " $(result) ;
98-
return $(result) ;
99-
}
100-
10148
rule linking ( properties * )
10249
{
10350
local result ;
@@ -419,7 +366,6 @@ rule openssl-lib-path ( properties * )
419366

420367
local result ;
421368
result += <search>$(OPENSSL_LIB) ;
422-
echo "openssl-lib-path = " $(result) ;
423369
return $(result) ;
424370
}
425371

@@ -454,7 +400,6 @@ rule openssl-include-path ( properties * )
454400

455401
local result ;
456402
result += <include>$(OPENSSL_INCLUDE) ;
457-
echo "openssl-include-path = " $(result) ;
458403
return $(result) ;
459404
}
460405

@@ -588,16 +533,51 @@ variant test_arm : debug
588533
<export-extra>on <asserts>on
589534
;
590535

591-
lib crypto : : <name>crypto <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
592-
lib ssl : : <name>ssl <use>crypto <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
593-
594-
# required for openssl on windows
595-
lib ssleay32 : : <name>ssleay32 <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
596-
lib libeay32 : : <name>libeay32 <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
597536
lib advapi32 : : <name>advapi32 ;
598537
lib user32 : : <name>user32 ;
599538
lib shell32 : : <name>shell32 ;
600539
lib gdi32 : : <name>gdi32 ;
540+
lib z : : <link>shared <name>z ;
541+
542+
# windows variants for libssl and libcrypto (they have different names and some
543+
# additional dependencies)
544+
lib crypto
545+
: # sources
546+
: # requirements
547+
<target-os>windows
548+
<openssl-version>pre1.1
549+
<name>libeay32
550+
<conditional>@openssl-lib-path
551+
: # default-build
552+
: # usage-requirements
553+
<conditional>@openssl-include-path
554+
<library>advapi32
555+
<library>user32
556+
<library>shell32
557+
<library>gdi32
558+
;
559+
560+
lib ssl
561+
: # sources
562+
: # requirements
563+
<target-os>windows
564+
<openssl-version>pre1.1
565+
<name>ssleay32
566+
<use>crypto
567+
<conditional>@openssl-lib-path
568+
: # default-build
569+
: # usage-requirments
570+
<conditional>@openssl-include-path
571+
<library>advapi32
572+
<library>user32
573+
<library>shell32
574+
<library>gdi32
575+
;
576+
577+
578+
lib crypto : : <name>crypto <use>z <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
579+
lib ssl : : <name>ssl <use>crypto <conditional>@openssl-lib-path : : <conditional>@openssl-include-path ;
580+
601581
lib dbghelp : : <name>dbghelp ;
602582

603583
# required for networking on beos
@@ -609,8 +589,7 @@ lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ;
609589

610590
# openssl on linux/bsd etc.
611591
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ;
612-
613-
alias openssl-libraries : : : : <conditional>@link-openssl ;
592+
lib dl : : <link>shared <name>dl ;
614593

615594
lib libsocket : : <use>libnsl <name>socket <link>shared <search>/usr/sfw/lib <link>shared ;
616595
lib libnsl : : <name>nsl <link>shared <search>/usr/sfw/lib <link>shared ;
@@ -825,8 +804,9 @@ lib torrent
825804
<link>shared:<define>TORRENT_BUILDING_SHARED
826805
<define>BOOST_NO_DEPRECATED
827806
<link>shared:<define>BOOST_SYSTEM_SOURCE
828-
<crypto>openssl:<library>openssl-libraries
829-
<crypto>libcrypto:<library>openssl-libraries
807+
<crypto>openssl:<library>ssl
808+
<crypto>openssl:<library>crypto
809+
<crypto>libcrypto:<library>crypto
830810

831811
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
832812
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp

bindings/python/Jamfile

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ my-python-extension libtorrent
152152
<toolset>darwin:<cxxflags>-Wno-deprecated-declarations
153153
<toolset>darwin:<cxxflags>-Wno-unused-command-line-argument
154154
<conditional>@libtorrent_linking
155+
<crypto>openssl:<library>/torrent//ssl
156+
<crypto>openssl:<library>/torrent//crypto
155157
: # default-build
156158
<warnings>all
157159
: # usage-requirements

bindings/python/src/error_code.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ namespace boost
4949

5050
#include <boost/asio/error.hpp>
5151
#if defined TORRENT_USE_OPENSSL
52-
#include <boost/asio/ssl/error.hpp>
52+
#include <boost/asio/ssl.hpp>
53+
#endif
54+
#if TORRENT_USE_I2P
55+
#include <libtorrent/i2p_stream.hpp>
5356
#endif
5457

5558
using namespace boost::python;

include/libtorrent/aux_/session_interface.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ POSSIBILITY OF SUCH DAMAGE.
4949
#include <memory>
5050

5151
#ifdef TORRENT_USE_OPENSSL
52-
#include "libtorrent/aux_/disable_warnings_push.hpp"
53-
#include <boost/asio/ssl/context.hpp>
54-
#include "libtorrent/aux_/disable_warnings_pop.hpp"
52+
// there is no forward declaration header for asio
53+
namespace boost {
54+
namespace asio {
55+
namespace ssl {
56+
class context;
57+
}
58+
}
59+
}
5560
#endif
5661

5762
namespace libtorrent {

include/libtorrent/http_connection.hpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ POSSIBILITY OF SUCH DAMAGE.
3939
#include <boost/optional.hpp>
4040

4141
#ifdef TORRENT_USE_OPENSSL
42-
#include <boost/asio/ssl/context.hpp>
42+
// there is no forward declaration header for asio
43+
namespace boost {
44+
namespace asio {
45+
namespace ssl {
46+
struct context;
47+
}
48+
}
49+
}
4350
#endif
4451

4552
#include "libtorrent/aux_/disable_warnings_pop.hpp"

include/libtorrent/torrent.hpp

+12
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ POSSIBILITY OF SUCH DAMAGE.
7373
#include "libtorrent/aux_/vector.hpp"
7474
#include "libtorrent/aux_/deferred_handler.hpp"
7575

76+
#ifdef TORRENT_USE_OPENSSL
77+
// there is no forward declaration header for asio
78+
namespace boost {
79+
namespace asio {
80+
namespace ssl {
81+
class context;
82+
class verify_context;
83+
}
84+
}
85+
}
86+
#endif
87+
7688
#if TORRENT_COMPLETE_TYPES_REQUIRED
7789
#include "libtorrent/peer_connection.hpp"
7890
#endif

include/libtorrent/tracker_manager.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ POSSIBILITY OF SUCH DAMAGE.
4646
#include <unordered_map>
4747

4848
#ifdef TORRENT_USE_OPENSSL
49-
#include "libtorrent/aux_/disable_warnings_push.hpp"
50-
#include <boost/asio/ssl/context.hpp>
51-
#include "libtorrent/aux_/disable_warnings_pop.hpp"
49+
// there is no forward declaration header for asio
50+
namespace boost {
51+
namespace asio {
52+
namespace ssl {
53+
class context;
54+
}
55+
}
56+
}
5257
#endif
5358

5459
#include "libtorrent/socket.hpp"

include/libtorrent/upnp.hpp

+10-18
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ POSSIBILITY OF SUCH DAMAGE.
3636
#include "libtorrent/socket.hpp"
3737
#include "libtorrent/error_code.hpp"
3838
#include "libtorrent/broadcast_socket.hpp"
39-
#include "libtorrent/http_connection.hpp"
4039
#include "libtorrent/deadline_timer.hpp"
4140
#include "libtorrent/enum_net.hpp"
4241
#include "libtorrent/resolver.hpp"
4342
#include "libtorrent/debug.hpp"
43+
#include "libtorrent/string_util.hpp"
4444
#include "libtorrent/aux_/portmap.hpp"
4545
#include "libtorrent/aux_/vector.hpp"
4646

@@ -49,6 +49,8 @@ POSSIBILITY OF SUCH DAMAGE.
4949
#include <set>
5050

5151
namespace libtorrent {
52+
struct http_connection;
53+
class http_parser;
5254

5355
namespace upnp_errors
5456
{
@@ -256,16 +258,12 @@ struct TORRENT_EXTRA_EXPORT upnp final
256258

257259
struct rootdevice
258260
{
259-
#if TORRENT_USE_ASSERTS
260-
rootdevice() {}
261-
~rootdevice()
262-
{
263-
TORRENT_ASSERT(magic == 1337);
264-
magic = 0;
265-
}
266-
rootdevice(rootdevice const&) = default;
267-
rootdevice& operator=(rootdevice const&) = default;
268-
#endif
261+
rootdevice();
262+
~rootdevice();
263+
rootdevice(rootdevice const&);
264+
rootdevice& operator=(rootdevice const&);
265+
rootdevice(rootdevice&&);
266+
rootdevice& operator=(rootdevice&&);
269267

270268
// the interface url, through which the list of
271269
// supported interfaces are fetched
@@ -310,13 +308,7 @@ struct TORRENT_EXTRA_EXPORT upnp final
310308
#if TORRENT_USE_ASSERTS
311309
int magic = 1337;
312310
#endif
313-
void close() const
314-
{
315-
TORRENT_ASSERT(magic == 1337);
316-
if (!upnp_connection) return;
317-
upnp_connection->close();
318-
upnp_connection.reset();
319-
}
311+
void close() const;
320312

321313
bool operator<(rootdevice const& rhs) const
322314
{ return url < rhs.url; }

src/block_cache.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,20 @@ void block_cache::clear(tailqueue<disk_io_job>& jobs)
11851185
for (int i = 0; i < cached_piece_entry::num_lrus; ++i)
11861186
m_lru[i].get_all();
11871187

1188-
m_pieces.clear();
1188+
// it's not ok to erase pieces with a refcount > 0
1189+
// since we're cancelling all jobs though, it shouldn't be too bad
1190+
// to let the jobs already running complete.
1191+
for (cache_t::iterator i = m_pieces.begin(); i != m_pieces.end();)
1192+
{
1193+
if (i->refcount == 0 && i->piece_refcount == 0)
1194+
{
1195+
i = m_pieces.erase(i);
1196+
}
1197+
else
1198+
{
1199+
++i;
1200+
}
1201+
}
11891202
}
11901203

11911204
void block_cache::move_to_ghost(cached_piece_entry* pe)

src/http_connection.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ POSSIBILITY OF SUCH DAMAGE.
4949
#include <algorithm>
5050
#include <sstream>
5151

52+
#ifdef TORRENT_USE_OPENSSL
53+
#include <boost/asio/ssl/context.hpp>
54+
#endif
55+
5256
using namespace std::placeholders;
5357

5458
namespace libtorrent {

src/tracker_manager.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ POSSIBILITY OF SUCH DAMAGE.
4040
#include "libtorrent/performance_counters.hpp"
4141
#include "libtorrent/socket_io.hpp"
4242

43+
#ifdef TORRENT_USE_OPENSSL
44+
#include <boost/asio/ssl/context.hpp>
45+
#endif
46+
4347
using namespace std::placeholders;
4448

4549
namespace libtorrent {

src/upnp.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ POSSIBILITY OF SUCH DAMAGE.
4040
#include "libtorrent/random.hpp"
4141
#include "libtorrent/aux_/time.hpp" // for aux::time_now()
4242
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
43+
#include "libtorrent/http_connection.hpp"
44+
45+
#if defined TORRENT_ASIO_DEBUGGING
4346
#include "libtorrent/debug.hpp"
47+
#endif
4448
#include "libtorrent/aux_/numeric_cast.hpp"
4549

4650
#include "libtorrent/aux_/disable_warnings_push.hpp"
@@ -70,6 +74,28 @@ namespace upnp_errors
7074

7175
static error_code ignore_error;
7276

77+
upnp::rootdevice::rootdevice() {}
78+
upnp::rootdevice::~rootdevice()
79+
{
80+
TORRENT_ASSERT(magic == 1337);
81+
#if TORRENT_USE_ASSERTS
82+
magic = 0;
83+
#endif
84+
}
85+
86+
upnp::rootdevice::rootdevice(rootdevice const&) = default;
87+
upnp::rootdevice& upnp::rootdevice::operator=(rootdevice const&) = default;
88+
upnp::rootdevice::rootdevice(rootdevice&&) = default;
89+
upnp::rootdevice& upnp::rootdevice::operator=(rootdevice&&) = default;
90+
91+
void upnp::rootdevice::close() const
92+
{
93+
TORRENT_ASSERT(magic == 1337);
94+
if (!upnp_connection) return;
95+
upnp_connection->close();
96+
upnp_connection.reset();
97+
}
98+
7399
// TODO: 3 bind the broadcast socket. it would probably have to be changed to a vector of interfaces to
74100
// bind to, since the broadcast socket opens one socket per local
75101
// interface by default

0 commit comments

Comments
 (0)