summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs
diff options
context:
space:
mode:
authoroci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-03-17 22:17:38 +0000
committeroci <oci@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-03-17 22:17:38 +0000
commit932a7b692db13a5469cf8e02fe1dad62f22c421a (patch)
treeb3db973eb43dda269ed7d27d5ec54af6dc3713c3 /TAO/orbsvcs
parent6ecada6c3ad1387bfb5aa008689fd6b9e5320a09 (diff)
downloadATCD-932a7b692db13a5469cf8e02fe1dad62f22c421a.tar.gz
ChangeLogTag: Sat Mar 17 16:15:14 2001 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r--TAO/orbsvcs/orbsvcs/Makefile.SSLIOP8
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp21
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp94
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h13
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.i7
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp20
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h4
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp32
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h11
10 files changed, 99 insertions, 113 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Makefile.SSLIOP b/TAO/orbsvcs/orbsvcs/Makefile.SSLIOP
index 863881a142d..ee370cdea73 100644
--- a/TAO/orbsvcs/orbsvcs/Makefile.SSLIOP
+++ b/TAO/orbsvcs/orbsvcs/Makefile.SSLIOP
@@ -1279,8 +1279,8 @@ realclean: clean
$(TAO_ROOT)/tao/Connector_Impl.inl \
$(TAO_ROOT)/tao/Connector_Impl.cpp \
SSLIOP/SSLIOP_Endpoint.h SSLIOP/SSLIOP_Endpoint.i \
- $(TAO_ROOT)/tao/Base_Connection_Property.h \
- $(TAO_ROOT)/tao/Base_Connection_Property.inl \
+ $(TAO_ROOT)/tao/Base_Transport_Property.h \
+ $(TAO_ROOT)/tao/Base_Transport_Property.inl \
$(TAO_ROOT)/tao/IIOP_Endpoint.h \
$(TAO_ROOT)/tao/IIOP_Endpoint.i
@@ -5424,8 +5424,8 @@ realclean: clean
SSLIOP/SSLIOP_Endpoint.h SSLIOP/SSLIOP_Endpoint.i \
$(TAO_ROOT)/tao/Timeprobe.h \
$(ACE_ROOT)/ace/Timeprobe.h \
- $(TAO_ROOT)/tao/Base_Connection_Property.h \
- $(TAO_ROOT)/tao/Base_Connection_Property.inl \
+ $(TAO_ROOT)/tao/Base_Transport_Property.h \
+ $(TAO_ROOT)/tao/Base_Transport_Property.inl \
$(TAO_ROOT)/tao/Messaging_Policy_i.h \
$(TAO_ROOT)/tao/Messaging_Policy_i.i \
$(TAO_ROOT)/tao/IIOP_Endpoint.h \
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp
index fc73ea9ab10..9e42db7e892 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp
@@ -8,7 +8,7 @@
#include "tao/debug.h"
#include "tao/ORB_Core.h"
#include "tao/Environment.h"
-#include "tao/Base_Connection_Property.h"
+#include "tao/Base_Transport_Property.h"
#include "tao/IIOP_Endpoint.h"
#include "ace/Strategies_T.h"
@@ -106,7 +106,7 @@ TAO_IIOP_SSL_Connector::close (void)
}
int
-TAO_IIOP_SSL_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
+TAO_IIOP_SSL_Connector::connect (TAO_Transport_Descriptor_Interface *desc,
TAO_Transport *&transport,
ACE_Time_Value *max_wait_time,
CORBA::Environment &)
@@ -155,11 +155,11 @@ TAO_IIOP_SSL_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
int result = 0;
TAO_IIOP_SSL_Connection_Handler *svc_handler = 0;
- TAO_Connection_Handler *conn_handler = 0;
+ TAO_Transport *base_transport = 0;
// Check the Cache first for connections
- if (this->orb_core ()->connection_cache ().find_handler (desc,
- conn_handler) == 0)
+ if (this->orb_core ()->transport_cache ().find_transport (desc,
+ base_transport) == 0)
{
if (TAO_debug_level > 5)
ACE_DEBUG ((LM_DEBUG,
@@ -168,7 +168,7 @@ TAO_IIOP_SSL_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
// We have found a connection and a handler
svc_handler =
ACE_dynamic_cast (TAO_IIOP_SSL_Connection_Handler *,
- conn_handler);
+ base_transport->connection_handler ());
}
else
{
@@ -223,10 +223,11 @@ TAO_IIOP_SSL_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
return -1;
}
+ base_transport = TAO_Transport::_duplicate (svc_handler->transport ());
// Add the handler to Cache
int retval =
- this->orb_core ()->connection_cache ().cache_handler (desc,
- svc_handler);
+ this->orb_core ()->transport_cache ().cache_transport (desc,
+ base_transport);
if (retval != 0 && TAO_debug_level > 0)
{
@@ -237,7 +238,9 @@ TAO_IIOP_SSL_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
}
}
- transport = svc_handler->transport ();
+ // No need to _duplicate and release since base_transport
+ // is going out of scope. transport now has control of base_transport.
+ transport = base_transport;
return 0;
}
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.h b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.h
index 0c582b853af..e2de55dfdab 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.h
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.h
@@ -50,7 +50,7 @@ public:
int open (TAO_ORB_Core *orb_core);
int close (void);
- int connect (TAO_Connection_Descriptor_Interface *desc,
+ int connect (TAO_Transport_Descriptor_Interface *desc,
TAO_Transport *&transport,
ACE_Time_Value *max_wait_time,
CORBA::Environment &ACE_TRY_ENV);
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp
index d97a502da03..c908eaef6c2 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp
@@ -6,7 +6,7 @@
#include "tao/Timeprobe.h"
#include "tao/debug.h"
-#include "tao/Base_Connection_Property.h"
+#include "tao/Base_Transport_Property.h"
#include "tao/ORB_Core.h"
#include "tao/ORB.h"
#include "tao/CDR.h"
@@ -32,8 +32,7 @@ TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler (
TAO_Connection_Handler (0),
current_ (),
current_impl_ (),
- transport_ (this, 0, 0),
- refcount_ (1),
+ pending_upcalls_ (1),
tcp_properties_ (0)
{
// This constructor should *never* get called, it is just here to
@@ -53,28 +52,36 @@ TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler (
TAO_Connection_Handler (orb_core),
current_ (),
current_impl_ (),
- transport_ (this, orb_core, flag),
- refcount_ (1),
+ pending_upcalls_ (1),
tcp_properties_ (ACE_static_cast
(TAO_IIOP_Properties *, arg))
{
+ TAO_SSLIOP_Transport* specific_transport = 0;
+ ACE_NEW(specific_transport,
+ TAO_SSLIOP_Transport(this, orb_core, 0));
+
+ // store this pointer (indirectly increment ref count)
+ this->transport(specific_transport);
+ TAO_Transport::release (specific_transport);
}
TAO_SSLIOP_Connection_Handler::
~TAO_SSLIOP_Connection_Handler (void)
{
- // If the socket has not already been closed.
- if (this->get_handle () != ACE_INVALID_HANDLE)
- {
- // Cannot deal with errors, and therefore they are ignored.
- this->transport_.send_buffered_messages ();
- }
- else
- {
- // Dequeue messages and delete message blocks.
- this->transport_.dequeue_all ();
- }
+ if (this->transport () != 0) {
+ // If the socket has not already been closed.
+ if (this->get_handle () != ACE_INVALID_HANDLE)
+ {
+ // Cannot deal with errors, and therefore they are ignored.
+ this->transport ()->send_buffered_messages ();
+ }
+ else
+ {
+ // Dequeue messages and delete message blocks.
+ this->transport ()->dequeue_all ();
+ }
+ }
}
@@ -98,7 +105,7 @@ TAO_SSLIOP_Connection_Handler::open (void*)
return -1;
#endif /* ! ACE_LACKS_TCP_NODELAY */
- if (this->transport_.wait_strategy ()->non_blocking ())
+ if (this->transport ()->wait_strategy ()->non_blocking ())
{
if (this->peer ().enable (ACE_NONBLOCK) == -1)
return -1;
@@ -189,8 +196,8 @@ TAO_SSLIOP_Connection_Handler::handle_close (ACE_HANDLE handle,
handle,
rm));
- --this->refcount_;
- if (this->refcount_ == 0 &&
+ --this->pending_upcalls_;
+ if (this->pending_upcalls_ == 0 &&
this->is_registered ())
{
// Set the flag to indicate that it is no longer registered with
@@ -202,16 +209,22 @@ TAO_SSLIOP_Connection_Handler::handle_close (ACE_HANDLE handle,
if (this->get_handle () != ACE_INVALID_HANDLE)
{
// Send the buffered messages first
- this->transport_.send_buffered_messages ();
-
- this->peer ().close ();
+ this->transport ()->send_buffered_messages ();
// Purge the entry too
- this->mark_invalid ();
+ this->transport ()->mark_invalid ();
+
+ // Signal the transport that we will no longer have
+ // a reference to it. This will eventually call
+ // TAO_Transport::release ().
+ this->transport (0);
+
+ this->peer ().close ();
}
- // Decrement the reference count
- this->decr_ref_count ();
+ // Follow usual Reactor-style lifecycle semantics and commit
+ // suicide.
+ delete this;
}
return 0;
@@ -246,16 +259,7 @@ TAO_SSLIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
}
int
-TAO_SSLIOP_Connection_Handler::close (u_long)
-{
- this->decr_ref_count ();
-
- return 0;
-}
-
-
-int
-TAO_SSLIOP_Connection_Handler::add_handler_to_cache (void)
+TAO_SSLIOP_Connection_Handler::add_transport_to_cache (void)
{
ACE_INET_Addr addr;
@@ -271,11 +275,11 @@ TAO_SSLIOP_Connection_Handler::add_handler_to_cache (void)
&tmpoint);
// Construct a property object
- TAO_Base_Connection_Property prop (&endpoint);
+ TAO_Base_Transport_Property prop (&endpoint);
// Add the handler to Cache
- return this->orb_core ()->connection_cache ().cache_handler (&prop,
- this);
+ return this->orb_core ()->transport_cache ().cache_transport (&prop,
+ this->transport ());
}
@@ -303,19 +307,19 @@ TAO_SSLIOP_Connection_Handler::process_listen_point_list (
// Construct a property object
- TAO_Base_Connection_Property prop (&endpoint);
+ TAO_Base_Transport_Property prop (&endpoint);
// Mark the connection as bidirectional
prop.set_bidir_flag (1);
// The property for this handler has changed. Recache the
// handler with this property
- int retval = this->recache_handler (&prop);
+ int retval = this->transport ()->recache_transport (&prop);
if (retval == -1)
return retval;
// Make the handler idle and ready for use
- this->make_idle ();
+ this->transport ()->make_idle ();
}
return 0;
@@ -343,10 +347,10 @@ TAO_SSLIOP_Connection_Handler::handle_input_i (ACE_HANDLE,
if (result == -1)
return -1;
- this->refcount_++;
+ this->pending_upcalls_++;
// Call the transport read the message
- result = this->transport_.read_process_message (max_wait_time);
+ result = this->transport ()->read_process_message (max_wait_time);
// Now the message has been read
if (result == -1 && TAO_debug_level > 0)
@@ -358,9 +362,7 @@ TAO_SSLIOP_Connection_Handler::handle_input_i (ACE_HANDLE,
}
// The upcall is done. Bump down the reference count
- --this->refcount_;
- if (this->refcount_ == 0)
- this->decr_ref_count ();
+ --this->pending_upcalls_;
if (result == 0 || result == -1)
{
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h
index ed5ea3e4134..7fe2df23e78 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h
@@ -94,9 +94,6 @@ public:
virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
ACE_Reactor_Mask = ACE_Event_Handler::NULL_MASK);
- /// Return the underlying transport object
- TAO_Transport *transport (void);
-
/// Return the underlying handle
virtual ACE_HANDLE fetch_handle (void);
@@ -104,11 +101,8 @@ public:
virtual int handle_timeout (const ACE_Time_Value &tv,
const void *arg = 0);
- /// Object termination hook.
- virtual int close (u_long flags = 0);
-
/// Add ourselves to Cache.
- int add_handler_to_cache (void);
+ int add_transport_to_cache (void);
/// Process the <listen_list>
int process_listen_point_list (IIOP::ListenPointList &listen_list);
@@ -147,14 +141,11 @@ protected:
private:
- /// Transport object reference.
- TAO_SSLIOP_Transport transport_;
-
/// Reference count.It is used to count nested upcalls on this
/// svc_handler i.e., the connection can close during nested upcalls,
/// you should not delete the svc_handler until the stack unwinds
/// from the nested upcalls.
- u_long refcount_;
+ u_long pending_upcalls_;
/// TCP configuration for this connection.
TAO_IIOP_Properties *tcp_properties_;
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.i b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.i
index 4a942f01923..be8576f9f98 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.i
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.i
@@ -3,13 +3,6 @@
// $Id$
-ACE_INLINE TAO_Transport *
-TAO_SSLIOP_Connection_Handler::transport (void)
-{
- return &(this->transport_);
-}
-
-
ACE_INLINE
TAO_SSL_State_Guard::TAO_SSL_State_Guard (
TAO_SSLIOP_Connection_Handler *handler,
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp
index 9c4381a2b7e..f877e9208aa 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp
@@ -103,7 +103,7 @@ TAO_SSLIOP_Connector::close (void)
}
int
-TAO_SSLIOP_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
+TAO_SSLIOP_Connector::connect (TAO_Transport_Descriptor_Interface *desc,
TAO_Transport *&transport,
ACE_Time_Value *max_wait_time,
CORBA::Environment &ACE_TRY_ENV)
@@ -201,11 +201,11 @@ TAO_SSLIOP_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
int result = 0;
TAO_SSLIOP_Connection_Handler *svc_handler = 0;
- TAO_Connection_Handler *conn_handler = 0;
+ TAO_Transport *base_transport = 0;
// Check the Cache first for connections
- if (this->orb_core ()->connection_cache ().find_handler (desc,
- conn_handler) == 0)
+ if (this->orb_core ()->transport_cache ().find_transport (desc,
+ base_transport) == 0)
{
if (TAO_debug_level > 5)
ACE_DEBUG ((LM_DEBUG,
@@ -215,7 +215,7 @@ TAO_SSLIOP_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
// We have found a connection and a handler
svc_handler =
ACE_dynamic_cast (TAO_SSLIOP_Connection_Handler *,
- conn_handler);
+ base_transport->connection_handler ());
}
else
{
@@ -270,11 +270,11 @@ TAO_SSLIOP_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
return -1;
}
-
+ base_transport = TAO_Transport::_duplicate (svc_handler->transport ());
// Add the handler to Cache
int retval =
- this->orb_core ()->connection_cache ().cache_handler (desc,
- svc_handler);
+ this->orb_core ()->transport_cache ().cache_transport (desc,
+ base_transport);
if (retval != 0 && TAO_debug_level > 0)
{
@@ -284,7 +284,9 @@ TAO_SSLIOP_Connector::connect (TAO_Connection_Descriptor_Interface *desc,
}
}
- transport = svc_handler->transport ();
+ // No need to _duplicate and release since base_transport
+ // is going out of scope. transport now has control of base_transport.
+ transport = base_transport;
return 0;
}
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h
index 966ae3f7d95..feeacbcf328 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.h
@@ -36,7 +36,7 @@
#include "tao/Resource_Factory.h"
-class TAO_Base_Connection_Property;
+class TAO_Base_Transport_Property;
class TAO_SSLIOP_Export TAO_SSLIOP_Connector : public TAO_IIOP_SSL_Connector
{
@@ -57,7 +57,7 @@ public:
// Pluggable.h
virtual int open (TAO_ORB_Core *orb_core);
virtual int close (void);
- virtual int connect (TAO_Connection_Descriptor_Interface *desc,
+ virtual int connect (TAO_Transport_Descriptor_Interface *desc,
TAO_Transport *&transport,
ACE_Time_Value *max_wait_time,
CORBA::Environment &ACE_TRY_ENV);
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp
index 1c612c1e3d3..5fad414b4a6 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp
@@ -60,22 +60,6 @@ TAO_SSLIOP_Transport::event_handler (void)
return this->connection_handler_;
}
-void
-TAO_SSLIOP_Transport::close_connection (void)
-{
- // First close the handle
- this->connection_handler_->handle_close ();
-
- // Purge the entry
- this->connection_handler_->purge_entry ();
-}
-
-int
-TAO_SSLIOP_Transport::idle (void)
-{
- return this->connection_handler_->make_idle ();
-}
-
ssize_t
TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block,
const ACE_Time_Value *max_wait_time,
@@ -203,10 +187,6 @@ TAO_SSLIOP_Transport::register_handler (void)
if (r == this->connection_handler_->reactor ())
return 0;
- // About to be registered with the reactor, so bump the ref
- // count
- this->connection_handler_->incr_ref_count ();
-
// Set the flag in the Connection Handler
this->connection_handler_->is_registered (1);
@@ -617,3 +597,15 @@ TAO_SSLIOP_Transport::get_listen_point (
return 1;
}
+
+void
+TAO_SSLIOP_Transport::transition_handler_state (void)
+{
+ connection_handler_ = 0;
+}
+
+TAO_Connection_Handler*
+TAO_SSLIOP_Transport::connection_handler (void) const
+{
+ return connection_handler_;
+}
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h
index 84b3c86cfaa..37e07b07a7f 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h
@@ -71,10 +71,6 @@ public:
virtual ACE_Event_Handler *event_handler (void);
- virtual void close_connection (void);
-
- virtual int idle (void);
-
/// Write the complete Message_Block chain to the connection.
virtual ssize_t send (const ACE_Message_Block *mblk,
const ACE_Time_Value *s = 0,
@@ -132,6 +128,13 @@ public:
/// Open teh service context list and process it.
virtual int tear_listen_point_list (TAO_InputCDR &cdr);
+ /// Method to do whatever it needs to do when the connection
+ /// handler is being closed and destroyed.
+ virtual void transition_handler_state (void);
+
+ // Access the connection handler
+ virtual TAO_Connection_Handler* connection_handler (void) const;
+
private:
/// Process the message that we have read