summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2004-10-26 23:36:21 +0000
committerMarc Laukien <marc@zeroc.com>2004-10-26 23:36:21 +0000
commit6205402933f97de744773e669151efdcedf82c2b (patch)
treec0ede132c0dd55a3030166f31fc22346a0e96606
parentmore HP-UX notes (diff)
downloadice-6205402933f97de744773e669151efdcedf82c2b.tar.bz2
ice-6205402933f97de744773e669151efdcedf82c2b.tar.xz
ice-6205402933f97de744773e669151efdcedf82c2b.zip
more fixes for thread per connection
-rw-r--r--cpp/src/Ice/ConnectionI.cpp22
-rw-r--r--cpp/src/IceSSL/SslClientTransceiver.h3
-rw-r--r--cpp/src/IceSSL/SslServerTransceiver.h3
-rw-r--r--cpp/src/IceSSL/SslTransceiver.cpp12
-rw-r--r--cpp/src/IceSSL/SslTransceiver.h8
5 files changed, 28 insertions, 20 deletions
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 9601398ac5d..9e1bbe09e7a 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -1525,7 +1525,17 @@ Ice::ConnectionI::setState(State state)
case StateClosed:
{
- if(_state == StateNotValidated)
+ if(_instance->threadPerConnection())
+ {
+ //
+ // If we are in thread per connection mode, we
+ // shutdown both for reading and writing. This will
+ // unblock and read call with an exception. The thread
+ // per connection then closes the transceiver.
+ //
+ _transceiver->shutdownReadWrite();
+ }
+ else if(_state == StateNotValidated)
{
//
// If we change from not validated we can close right
@@ -1551,16 +1561,6 @@ Ice::ConnectionI::setState(State state)
_transceiver = 0;
//notifyAll(); // We notify already below.
}
- else if(_instance->threadPerConnection())
- {
- //
- // If we are in thread per connection mode, we
- // shutdown both for reading and writing. This will
- // unblock and read call with an exception. The thread
- // per connection then closes the transceiver.
- //
- _transceiver->shutdownReadWrite();
- }
else
{
//
diff --git a/cpp/src/IceSSL/SslClientTransceiver.h b/cpp/src/IceSSL/SslClientTransceiver.h
index 27a1c6af9b3..ce9d4f27f7e 100644
--- a/cpp/src/IceSSL/SslClientTransceiver.h
+++ b/cpp/src/IceSSL/SslClientTransceiver.h
@@ -20,11 +20,14 @@ class ClientContext;
class SslClientTransceiver : public SslTransceiver
{
public:
+
virtual int handshake(int timeout = 0);
virtual void write(IceInternal::Buffer&, int);
protected:
+
virtual void showConnectionInfo();
+
SslClientTransceiver(const OpenSSLPluginIPtr&, SOCKET, const CertificateVerifierPtr&, SSL*);
friend class ClientContext;
};
diff --git a/cpp/src/IceSSL/SslServerTransceiver.h b/cpp/src/IceSSL/SslServerTransceiver.h
index 04698df1ebc..95eafb2c0ac 100644
--- a/cpp/src/IceSSL/SslServerTransceiver.h
+++ b/cpp/src/IceSSL/SslServerTransceiver.h
@@ -18,11 +18,14 @@ namespace IceSSL
class SslServerTransceiver : public SslTransceiver
{
public:
+
virtual int handshake(int timeout = 0);
virtual void write(IceInternal::Buffer&, int);
protected:
+
virtual void showConnectionInfo();
+
SslServerTransceiver(const OpenSSLPluginIPtr&, SOCKET, const CertificateVerifierPtr&, SSL*);
friend class ServerContext;
};
diff --git a/cpp/src/IceSSL/SslTransceiver.cpp b/cpp/src/IceSSL/SslTransceiver.cpp
index f7c9e8260ac..10e85d223d4 100644
--- a/cpp/src/IceSSL/SslTransceiver.cpp
+++ b/cpp/src/IceSSL/SslTransceiver.cpp
@@ -68,7 +68,7 @@ IceSSL::SslTransceiver::close()
int retries = -numRetries;
do
{
- shutdown = internalShutdown();
+ shutdown = internalShutdownWrite(0);
retries++;
}
while((shutdown == 0) && (retries < 0));
@@ -105,7 +105,7 @@ IceSSL::SslTransceiver::shutdownWrite()
int retries = -numRetries;
do
{
- shutdown = internalShutdown();
+ shutdown = internalShutdownWrite(0);
retries++;
}
while((shutdown == 0) && (retries < 0));
@@ -123,15 +123,17 @@ IceSSL::SslTransceiver::shutdownReadWrite()
out << "shutting down ssl connection for reading and writing\n" << toString();
}
+/*
int shutdown = 0;
int numRetries = 100;
int retries = -numRetries;
do
{
- shutdown = internalShutdown();
+ shutdown = internalShutdownWrite(0);
retries++;
}
while((shutdown == 0) && (retries < 0));
+*/
assert(_fd != INVALID_SOCKET);
shutdownSocketReadWrite(_fd);
@@ -481,7 +483,7 @@ IceSSL::SslTransceiver::verifyCertificate(int preVerifyOkay, X509_STORE_CTX* x50
//
int
-IceSSL::SslTransceiver::internalShutdown(int timeout)
+IceSSL::SslTransceiver::internalShutdownWrite(int timeout)
{
if(_sslConnection == 0)
{
@@ -704,7 +706,7 @@ IceSSL::SslTransceiver::initialize(int timeout)
case Shutdown :
{
- retCode = internalShutdown(timeout);
+ retCode = internalShutdownWrite(timeout);
break;
}
diff --git a/cpp/src/IceSSL/SslTransceiver.h b/cpp/src/IceSSL/SslTransceiver.h
index 06a3c01cc40..5402d0ebbf1 100644
--- a/cpp/src/IceSSL/SslTransceiver.h
+++ b/cpp/src/IceSSL/SslTransceiver.h
@@ -148,7 +148,7 @@ public:
protected:
- virtual int internalShutdown(int timeout = 0);
+ int internalShutdownWrite(int timeout);
int connect();
int accept();
@@ -170,8 +170,6 @@ protected:
static void addTransceiver(SSL*, SslTransceiver*);
static void removeTransceiver(SSL*);
- virtual void showConnectionInfo() = 0;
-
void showCertificateChain(BIO*);
void showPeerCertificate(BIO*, const char*);
void showSharedCiphers(BIO*);
@@ -180,7 +178,9 @@ protected:
void showHandshakeStats(BIO*);
void showClientCAList(BIO*, const char*);
- void setLastError(int errorCode) { _lastError = errorCode; };
+ void setLastError(int errorCode) { _lastError = errorCode; }
+
+ virtual void showConnectionInfo() = 0;
static SslTransceiverMap _transceiverMap;
static IceUtil::StaticMutex _transceiverRepositoryMutex;