Ticket #10212: ssl_accept_patch

File ssl_accept_patch, 2.2 KB (added by Sergei Nikishin <nordsturm@…>, 8 years ago)
Line 
1diff --git a/include/boost/asio/ssl/detail/engine.hpp b/include/boost/asio/ssl/detail/engine.hpp
2index 8b24a96..8250e47 100644
3--- a/include/boost/asio/ssl/detail/engine.hpp
4+++ b/include/boost/asio/ssl/detail/engine.hpp
5@@ -19,7 +19,6 @@
6
7 #if !defined(BOOST_ASIO_ENABLE_OLD_SSL)
8 # include <boost/asio/buffer.hpp>
9-# include <boost/asio/detail/static_mutex.hpp>
10 # include <boost/asio/ssl/detail/openssl_types.hpp>
11 # include <boost/asio/ssl/detail/verify_callback.hpp>
12 # include <boost/asio/ssl/stream_base.hpp>
13@@ -120,10 +119,6 @@ private:
14 BOOST_ASIO_DECL static int verify_callback_function(
15 int preverified, X509_STORE_CTX* ctx);
16
17- // The SSL_accept function may not be thread safe. This mutex is used to
18- // protect all calls to the SSL_accept function.
19- BOOST_ASIO_DECL static boost::asio::detail::static_mutex& accept_mutex();
20-
21 // Perform one operation. Returns >= 0 on success or error, want_read if the
22 // operation needs more input, or want_write if it needs to write some output
23 // before the operation can complete.
24diff --git a/include/boost/asio/ssl/detail/impl/engine.ipp b/include/boost/asio/ssl/detail/impl/engine.ipp
25index 5aa9b5a..264c518 100644
26--- a/include/boost/asio/ssl/detail/impl/engine.ipp
27+++ b/include/boost/asio/ssl/detail/impl/engine.ipp
28@@ -45,8 +45,6 @@ engine::engine(SSL_CTX* context)
29 boost::asio::detail::throw_error(ec, "engine");
30 }
31
32- accept_mutex().init();
33-
34 ::SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE);
35 ::SSL_set_mode(ssl_, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
36 #if defined(SSL_MODE_RELEASE_BUFFERS)
37@@ -225,12 +223,6 @@ const boost::system::error_code& engine::map_error_code(
38 return ec;
39 }
40
41-boost::asio::detail::static_mutex& engine::accept_mutex()
42-{
43- static boost::asio::detail::static_mutex mutex = BOOST_ASIO_STATIC_MUTEX_INIT;
44- return mutex;
45-}
46-
47 engine::want engine::perform(int (engine::* op)(void*, std::size_t),
48 void* data, std::size_t length, boost::system::error_code& ec,
49 std::size_t* bytes_transferred)
50@@ -287,7 +279,6 @@ engine::want engine::perform(int (engine::* op)(void*, std::size_t),
51
52 int engine::do_accept(void*, std::size_t)
53 {
54- boost::asio::detail::static_mutex::scoped_lock lock(accept_mutex());
55 return ::SSL_accept(ssl_);
56 }
57