diff options
Diffstat (limited to 'cpp/src/Ice/SslTransceiver.cpp')
-rw-r--r-- | cpp/src/Ice/SslTransceiver.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/cpp/src/Ice/SslTransceiver.cpp b/cpp/src/Ice/SslTransceiver.cpp index 2a153b3d375..d0de45476b2 100644 --- a/cpp/src/Ice/SslTransceiver.cpp +++ b/cpp/src/Ice/SslTransceiver.cpp @@ -7,27 +7,27 @@ // 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 <Ice/SslException.h> +#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;
-
+using IceSecurity::SecurityException; +using IceSecurity::Ssl::InitException; +using IceSecurity::Ssl::ReInitException; +using IceSecurity::Ssl::ShutdownException; + int IceInternal::SslTransceiver::fd() { @@ -37,8 +37,8 @@ IceInternal::SslTransceiver::fd() void IceInternal::SslTransceiver::close() { - METHOD_INV("SslTransceiver::close()");
-
+ METHOD_INV("SslTransceiver::close()"); + if (_traceLevels->network >= 1) { ostringstream s; @@ -47,19 +47,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()");
+ + METHOD_RET("SslTransceiver::close()"); } void IceInternal::SslTransceiver::shutdown() { - METHOD_INV("SslTransceiver::shutdown()");
-
+ METHOD_INV("SslTransceiver::shutdown()"); + if (_traceLevels->network >= 2) { ostringstream s; @@ -68,31 +68,31 @@ IceInternal::SslTransceiver::shutdown() } ::shutdown(_fd, SHUT_WR); // Shutdown socket for writing -
- METHOD_RET("SslTransceiver::shutdown()");
+ + METHOD_RET("SslTransceiver::shutdown()"); } void IceInternal::SslTransceiver::write(Buffer& buf, int timeout) -{
- METHOD_INV("SslTransceiver::write()")
- _sslConnection->write(buf, timeout);
- METHOD_RET("SslTransceiver::write()");
+{ + METHOD_INV("SslTransceiver::write()") + _sslConnection->write(buf, timeout); + 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()");
+ METHOD_INV("SslTransceiver::read()"); + + if (!_sslConnection->read(buf, timeout)) + { + ConnectionLostException clEx(__FILE__, __LINE__); + clEx.error = 0; + throw clEx; + } + + METHOD_RET("SslTransceiver::read()"); } string @@ -101,15 +101,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 +117,17 @@ IceInternal::SslTransceiver::SslTransceiver(const InstancePtr& instance, int fd, IceInternal::SslTransceiver::~SslTransceiver() { assert(_fd == INVALID_SOCKET); -
- cleanUpSSL();
+ + cleanUpSSL(); +} + +void +IceInternal::SslTransceiver::cleanUpSSL() +{ + if (_sslConnection != 0) + { + _sslConnection->shutdown(); + delete _sslConnection; + _sslConnection = 0; + } } -
-void
-IceInternal::SslTransceiver::cleanUpSSL()
-{
- if (_sslConnection != 0)
- {
- _sslConnection->shutdown();
- delete _sslConnection;
- _sslConnection = 0;
- }
-}
|