diff --git a/src/cpp/ripple/AutoSocket.cpp b/src/cpp/ripple/AutoSocket.cpp index 732716194e..dd553a4c57 100644 --- a/src/cpp/ripple/AutoSocket.cpp +++ b/src/cpp/ripple/AutoSocket.cpp @@ -25,6 +25,7 @@ void AutoSocket::handle_autodetect(const error_code& ec) { // ssl mSecure = true; SSLSocket().async_handshake(ssl_socket::server, mCallback); + mCallback = callback(); } } diff --git a/src/cpp/ripple/AutoSocket.h b/src/cpp/ripple/AutoSocket.h index 019618dbd8..d8529ea282 100644 --- a/src/cpp/ripple/AutoSocket.h +++ b/src/cpp/ripple/AutoSocket.h @@ -10,7 +10,8 @@ // Socket wrapper that supports both SSL and non-SSL connections. // Generally, handle it as you would an SSL connection. -// For outbound non-SSL connections, just don't call async_handshake. +// To force a non-SSL connection, just don't call async_handshake. +// To force SSL only inbound, call setSSLOnly. namespace basio = boost::asio; namespace bassl = basio::ssl; @@ -37,10 +38,12 @@ public: ssl_socket& SSLSocket() { return mSocket; } plain_socket& PlainSocket() { return mSocket.next_layer(); } + void setSSLOnly() { mBuffer.clear(); } + void async_handshake(ssl_socket::handshake_type type, callback cbFunc) { mSecure = true; - if (type == ssl_socket::client) + if ((type == ssl_socket::client) || (mBuffer.empty())) SSLSocket().async_handshake(type, cbFunc); else { @@ -92,3 +95,5 @@ protected: }; #endif + +// vim:ts=4