fix build for boost < 1.47

This commit is contained in:
Arvid Norberg 2012-02-23 04:32:50 +00:00
parent f1365a7a52
commit 6c395cedee
2 changed files with 14 additions and 2 deletions

View File

@ -47,6 +47,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/enable_shared_from_this.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/version.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
@ -954,7 +955,10 @@ namespace libtorrent
#ifdef TORRENT_USE_OPENSSL
boost::shared_ptr<asio::ssl::context> m_ssl_ctx;
#if BOOST_VERSION > 104600
bool verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx);
#endif
void init_ssl(std::string const& cert);
#endif

View File

@ -85,9 +85,11 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef TORRENT_USE_OPENSSL
#include "libtorrent/ssl_stream.hpp"
#include <boost/asio/ssl/context.hpp>
#if BOOST_VERSION > 104600
#include <boost/asio/ssl/rfc2818_verification.hpp>
#include <boost/asio/ssl/verify_context.hpp>
#endif
#endif // BOOST_VERSION
#endif // TORRENT_USE_OPENSSL
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
#include "libtorrent/struct_debug.hpp"
@ -1287,6 +1289,7 @@ namespace libtorrent
#ifdef TORRENT_USE_OPENSSL
#if BOOST_VERSION > 104600
bool torrent::verify_peer_cert(bool preverified, boost::asio::ssl::verify_context& ctx)
{
// if the cert wasn't signed by the correct CA, fail the verification
@ -1372,6 +1375,7 @@ namespace libtorrent
return false;
}
#endif // BOOST_VERSION
void torrent::init_ssl(std::string const& cert)
{
@ -1388,6 +1392,7 @@ namespace libtorrent
TORRENT_ASSERT(RAND_status() == 1);
#if BOOST_VERSION > 104600
// create the SSL context for this torrent. We need to
// inject the root certificate, and no other, to
// verify other peers against
@ -1469,9 +1474,12 @@ namespace libtorrent
#endif
// if all went well, set the torrent ssl context to this one
m_ssl_ctx = ctx;
// tell the client we need a cert for this torrent
alerts().post_alert(torrent_need_cert_alert(get_handle()));
#else
set_error(asio::error::not_supported, "x.509 certificate");
pause();
#endif
}
#endif // TORRENT_OPENSSL