Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79519 - trunk/boost/asio/ssl/detail/impl
From: chris_at_[hidden]
Date: 2012-07-15 00:17:07


Author: chris_kohlhoff
Date: 2012-07-15 00:17:06 EDT (Sun, 15 Jul 2012)
New Revision: 79519
URL: http://svn.boost.org/trac/boost/changeset/79519

Log:
Throw exception if SSL engine initialisation fails. Refs #6303
Text files modified:
   trunk/boost/asio/ssl/detail/impl/engine.ipp | 10 ++++++++++
   1 files changed, 10 insertions(+), 0 deletions(-)

Modified: trunk/boost/asio/ssl/detail/impl/engine.ipp
==============================================================================
--- trunk/boost/asio/ssl/detail/impl/engine.ipp (original)
+++ trunk/boost/asio/ssl/detail/impl/engine.ipp 2012-07-15 00:17:06 EDT (Sun, 15 Jul 2012)
@@ -18,7 +18,10 @@
 #include <boost/asio/detail/config.hpp>
 
 #if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
+# include <boost/asio/detail/throw_error.hpp>
+# include <boost/asio/error.hpp>
 # include <boost/asio/ssl/detail/engine.hpp>
+# include <boost/asio/ssl/error.hpp>
 # include <boost/asio/ssl/verify_context.hpp>
 #endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
 
@@ -34,6 +37,13 @@
 engine::engine(SSL_CTX* context)
   : ssl_(::SSL_new(context))
 {
+ if (!ssl_)
+ {
+ boost::system::error_code ec(::ERR_get_error(),
+ boost::asio::error::get_ssl_category());
+ boost::asio::detail::throw_error(ec, "engine");
+ }
+
   accept_mutex().init();
 
   ::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk