diff options
Diffstat (limited to 'cpp/src/Ice/SslTransceiver.cpp')
-rw-r--r-- | cpp/src/Ice/SslTransceiver.cpp | 105 |
1 files changed, 50 insertions, 55 deletions
diff --git a/cpp/src/Ice/SslTransceiver.cpp b/cpp/src/Ice/SslTransceiver.cpp index d0de45476b2..47fc85a627e 100644 --- a/cpp/src/Ice/SslTransceiver.cpp +++ b/cpp/src/Ice/SslTransceiver.cpp @@ -7,27 +7,22 @@ // All Rights Reserved // // ********************************************************************** - -#include <Ice/Security.h> -#include <Ice/SslConnection.h> -#include <Ice/SslTransceiver.h> +
+#include <Ice/Security.h>
+#include <Ice/SslConnection.h>
+#include <Ice/SslTransceiver.h>
#include <Ice/Instance.h> #include <Ice/TraceLevels.h> #include <Ice/Logger.h> #include <Ice/Buffer.h> #include <Ice/Network.h> #include <Ice/Exception.h> -#include <Ice/SslException.h> -#include <sstream> +#include <sstream>
using namespace std; using namespace Ice; using namespace IceInternal; -using IceSecurity::SecurityException; -using IceSecurity::Ssl::InitException; -using IceSecurity::Ssl::ReInitException; -using IceSecurity::Ssl::ShutdownException; - +
int IceInternal::SslTransceiver::fd() { @@ -37,8 +32,8 @@ IceInternal::SslTransceiver::fd() void IceInternal::SslTransceiver::close() { - METHOD_INV("SslTransceiver::close()"); - + ICE_METHOD_INV("SslTransceiver::close()");
+
if (_traceLevels->network >= 1) { ostringstream s; @@ -47,19 +42,19 @@ IceInternal::SslTransceiver::close() } int fd = _fd; - cleanUpSSL(); + cleanUpSSL();
_fd = INVALID_SOCKET; ::shutdown(fd, SHUT_RDWR); // helps to unblock threads in recv() closeSocket(fd); - - METHOD_RET("SslTransceiver::close()"); +
+ ICE_METHOD_RET("SslTransceiver::close()");
} void IceInternal::SslTransceiver::shutdown() { - METHOD_INV("SslTransceiver::shutdown()"); - + ICE_METHOD_INV("SslTransceiver::shutdown()");
+
if (_traceLevels->network >= 2) { ostringstream s; @@ -68,31 +63,31 @@ IceInternal::SslTransceiver::shutdown() } ::shutdown(_fd, SHUT_WR); // Shutdown socket for writing - - METHOD_RET("SslTransceiver::shutdown()"); +
+ ICE_METHOD_RET("SslTransceiver::shutdown()");
} void IceInternal::SslTransceiver::write(Buffer& buf, int timeout) -{ - METHOD_INV("SslTransceiver::write()") - _sslConnection->write(buf, timeout); - METHOD_RET("SslTransceiver::write()"); +{
+ ICE_METHOD_INV("SslTransceiver::write()")
+ _sslConnection->write(buf, timeout);
+ ICE_METHOD_RET("SslTransceiver::write()");
} void IceInternal::SslTransceiver::read(Buffer& buf, int timeout) { - METHOD_INV("SslTransceiver::read()"); - - if (!_sslConnection->read(buf, timeout)) - { - ConnectionLostException clEx(__FILE__, __LINE__); - clEx.error = 0; - throw clEx; - } - - METHOD_RET("SslTransceiver::read()"); + ICE_METHOD_INV("SslTransceiver::read()");
+
+ if (!_sslConnection->read(buf, timeout))
+ {
+ ConnectionLostException clEx(__FILE__, __LINE__);
+ clEx.error = 0;
+ throw clEx;
+ }
+
+ ICE_METHOD_RET("SslTransceiver::read()");
} string @@ -101,15 +96,15 @@ IceInternal::SslTransceiver::toString() const return fdToString(_fd); } -IceInternal::SslTransceiver::SslTransceiver(const InstancePtr& instance, int fd, Connection* sslConnection) : - _instance(instance), - _fd(fd), - _traceLevels(instance->traceLevels()), - _logger(instance->logger()), - _sslConnection(sslConnection) +IceInternal::SslTransceiver::SslTransceiver(const InstancePtr& instance, int fd, Connection* sslConnection) :
+ _instance(instance),
+ _fd(fd),
+ _traceLevels(instance->traceLevels()),
+ _logger(instance->logger()),
+ _sslConnection(sslConnection)
{ - assert(sslConnection != 0); - + assert(sslConnection != 0);
+
FD_ZERO(&_rFdSet); FD_ZERO(&_wFdSet); } @@ -117,17 +112,17 @@ IceInternal::SslTransceiver::SslTransceiver(const InstancePtr& instance, int fd, IceInternal::SslTransceiver::~SslTransceiver() { assert(_fd == INVALID_SOCKET); - - cleanUpSSL(); -} - -void -IceInternal::SslTransceiver::cleanUpSSL() -{ - if (_sslConnection != 0) - { - _sslConnection->shutdown(); - delete _sslConnection; - _sslConnection = 0; - } +
+ cleanUpSSL();
} +
+void
+IceInternal::SslTransceiver::cleanUpSSL()
+{
+ if (_sslConnection != 0)
+ {
+ _sslConnection->shutdown();
+ delete _sslConnection;
+ _sslConnection = 0;
+ }
+}
|