diff options
Diffstat (limited to 'cpp/src/IceSSL/OpenSSLPluginI.cpp')
-rw-r--r-- | cpp/src/IceSSL/OpenSSLPluginI.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp index e3d0b833696..8a440184c58 100644 --- a/cpp/src/IceSSL/OpenSSLPluginI.cpp +++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp @@ -7,13 +7,14 @@ // // ********************************************************************** +#include <IceSSL/OpenSSLPluginI.h> + #include <Ice/LoggerUtil.h> #include <Ice/Properties.h> #include <Ice/ProtocolPluginFacade.h> #include <Ice/Communicator.h> #include <Ice/LocalException.h> -#include <IceSSL/OpenSSLPluginI.h> #include <IceSSL/TraceLevels.h> #include <IceSSL/Exception.h> #include <IceSSL/ConfigParser.h> @@ -247,37 +248,35 @@ IceSSL::OpenSSLPluginI::~OpenSSLPluginI() } SslTransceiverPtr -IceSSL::OpenSSLPluginI::createTransceiver(ContextType connectionType, int socket, int timeout) +IceSSL::OpenSSLPluginI::createServerTransceiver(int socket, int timeout) { IceUtil::RecMutex::Lock sync(_configMutex); - if(connectionType == ClientServer) + // Configure the context if need be. + if(!isConfigured(IceSSL::Server)) { - UnsupportedContextException unsupportedException(__FILE__, __LINE__); + configure(IceSSL::Server); + } - unsupportedException.message = "unable to create client/server connections"; + SslTransceiverPtr transceiver; - throw unsupportedException; - } + return _serverContext.createTransceiver(socket, this, timeout); +} + +SslTransceiverPtr +IceSSL::OpenSSLPluginI::createClientTransceiver(int socket, int timeout) +{ + IceUtil::RecMutex::Lock sync(_configMutex); // Configure the context if need be. - if(!isConfigured(connectionType)) + if(!isConfigured(IceSSL::Client)) { - configure(connectionType); + configure(IceSSL::Client); } SslTransceiverPtr transceiver; - if(connectionType == Client) - { - transceiver = _clientContext.createTransceiver(socket, this, timeout); - } - else if(connectionType == Server) - { - transceiver = _serverContext.createTransceiver(socket, this, timeout); - } - - return transceiver; + return _clientContext.createTransceiver(socket, this, timeout); } bool |