summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-05-17 19:12:46 +0000
committerdai_y <dai_y@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-05-17 19:12:46 +0000
commitd67001ef6d184c97ddc798ebc49890673585446d (patch)
tree7442cd5208c7e82d0baa48dab5a4969fafd20dab
parentfa775798899ddc5aab588bed1e76f0777df20e69 (diff)
downloadATCD-d67001ef6d184c97ddc798ebc49890673585446d.tar.gz
Wed May 17 19:09:36 UTC 2006 Yan Dai <dai_y@ociweb.com>
-rw-r--r--TAO/ChangeLog45
-rw-r--r--TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp8
-rw-r--r--TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp6
-rw-r--r--TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp11
-rw-r--r--TAO/tao/IIOP_Acceptor.cpp235
-rw-r--r--TAO/tao/IIOP_Acceptor.h10
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Handle_T.inl9
7 files changed, 201 insertions, 123 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 10caf8ef587..5dc0c4ccdc9 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,48 @@
+Wed May 17 19:09:36 UTC 2006 Yan Dai <dai_y@ociweb.com>
+
+ Merged OCI's changes
+ "Fri May 12 21:59:41 UTC 2006 Yan Dai <dai_y@ociweb.com>"
+
+ * TAO/tao/Intrusive_Ref_Count_Handle_T.inl:
+
+ Fixed a potential memory leaks in operator==(T*) function.
+ The memory leak could happen when this assignment operator
+ is used to assign the same instance.
+
+ * TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp:
+
+ Made the TP_Dispatchable_Visitor object reset() called after
+ the request is dispatched. This would avoid the delay deletion
+ of the request and its referenced objects.
+
+ * tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp:
+
+ Made the transport object in TAO_ServerRequest be reference
+ counted by the CSD. Increment the reference counter when the
+ TAO_ServerRequest is cloned, and decrement the reference counter
+ when the server request is destroyed. This would avoid crash
+ when the transport object is destroyed but CSD has not finished
+ dispatching the request.
+
+ Merged OCI's changes
+ "Thu Apr 20 13:29:44 2006 Ciju John <john_c@ociweb.com>"
+
+ Made an SSLIOP endpoint value of 'iiop://:/ssl_port=xyz' listen
+ on all available network interfaces instead of listening on a
+ specific IP address. These changes make the 'iiop://:/ssl_port=xyz'
+ and 'iiop:///ssl_port=xyz' have same semantics.
+
+ * tao/IIOP_Acceptor.h :
+ * tao/IIOP_Acceptor.cpp :
+
+ Refactored the address parsing code into a new method
+ 'parse_address'.
+
+ * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp (open):
+
+ Use TAO_IIOP_Acceptor::parse_address() to initialize
+ ACE_INET_Addr.
+
Wed May 17 18:47:22 UTC 2006 Phil Mesnier <mesnier_p@ociweb.com>
* tests/AMH_Oneway/server.cpp:
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp
index b4cd56e4806..41428c0a1ed 100644
--- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp
+++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Acceptor.cpp
@@ -377,6 +377,11 @@ TAO::SSLIOP::Acceptor::open (TAO_ORB_Core *orb_core,
minor) != 0)
return -1;
+ ACE_INET_Addr addr;
+ ACE_CString specified_hostname;
+ if (this->parse_address (address, addr, specified_hostname) == -1)
+ return -1;
+
// Open the non-SSL enabled endpoints, then open the SSL enabled
// endpoints.
if (this->IIOP_SSL_Acceptor::open (orb_core,
@@ -389,8 +394,7 @@ TAO::SSLIOP::Acceptor::open (TAO_ORB_Core *orb_core,
// The SSL port is set in the parse_options() method. All we have
// to do is call open_i()
- ACE_INET_Addr addr (this->ssl_component_.port,
- this->addrs_[0].get_host_addr ());
+ addr.set_port_number (this->ssl_component_.port);
return this->ssliop_open_i (orb_core,
addr,
diff --git a/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp
index f8cc7c0d008..fc3257d8ddf 100644
--- a/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp
+++ b/TAO/tao/CSD_Framework/CSD_FW_Server_Request_Wrapper.cpp
@@ -43,6 +43,10 @@ TAO::CSD::FW_Server_Request_Wrapper::~FW_Server_Request_Wrapper()
delete [] opname;
delete this->request_->operation_details_;
}
+
+ if (this->request_->transport_ != 0)
+ this->request_->transport_->remove_reference ();
+
delete this->request_;
}
}
@@ -180,6 +184,8 @@ TAO::CSD::FW_Server_Request_Wrapper::clone (TAO_ServerRequest*& request)
// TYPE: TAO_Transport*
// ACTION: Assuming that a shallow-copy is ok here.
clone_obj->transport_ = request->transport_;
+ if (clone_obj->transport_ != 0)
+ clone_obj->transport_->add_reference ();
// TYPE: CORBA::Boolean
// ACTION: Primitive data type assignment.
diff --git a/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp
index adc18ab7c7f..a196ea9583d 100644
--- a/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp
+++ b/TAO/tao/CSD_ThreadPool/CSD_TP_Task.cpp
@@ -175,12 +175,6 @@ TAO::CSD::TP_Task::svc()
// There is no need to visit the queue if it is empty.
if (!this->queue_.is_empty())
{
- // Reset the visitor since we use it over and over. This
- // will cause the visitor to drop any reference to
- // a request that it may still be holding from a prior
- // call to accept_visitor().
- dispatchable_visitor.reset();
-
// Visit the requests in the queue in hopes of
// locating the first "dispatchable" (ie, not busy) request.
// If a dispatchable request is located, it is extracted
@@ -225,6 +219,11 @@ TAO::CSD::TP_Task::svc()
this->work_available_.signal();
}
+ // Reset the visitor since we use it over and over. This
+ // will cause the visitor to drop any reference to
+ // the dispatched request.
+ dispatchable_visitor.reset();
+
// Note that the request will be "released" here when the request
// handle falls out of scope and its destructor performs the
// _remove_ref() call on the underlying TP_Request object.
diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp
index 8663c1118c3..5f9b7af6693 100644
--- a/TAO/tao/IIOP_Acceptor.cpp
+++ b/TAO/tao/IIOP_Acceptor.cpp
@@ -304,51 +304,13 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core,
if (this->parse_options (options) == -1)
return -1;
+ ACE_CString specified_hostname;
ACE_INET_Addr addr;
- const char *port_separator_loc = ACE_OS::strchr (address, ':');
- const char *specified_hostname = 0;
- char tmp_host[MAXHOSTNAMELEN + 1];
-
-#if defined (ACE_HAS_IPV6)
- // IPv6 numeric address in host string?
- bool ipv6_in_host = false;
-
-
- // Check if this is a (possibly) IPv6 supporting profile containing a
- // numeric IPv6 address representation.
- if ((this->version_.major > TAO_MIN_IPV6_IIOP_MAJOR ||
- this->version_.minor >= TAO_MIN_IPV6_IIOP_MINOR) &&
- address[0] == '[')
- {
- // In this case we have to find the end of the numeric address and
- // start looking for the port separator from there.
- const char *cp_pos = ACE_OS::strchr(address, ']');
- if (cp_pos == 0)
- {
- // No valid IPv6 address specified.
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("TAO (%P|%t) - ")
- ACE_TEXT ("IIOP_Acceptor::open, ")
- ACE_TEXT ("Invalid IPv6 decimal address specified\n\n")),
- -1);
- }
- else
- {
- if (cp_pos[1] == ':') // Look for a port
- port_separator_loc = cp_pos + 1;
- else
- port_separator_loc = 0;
- // Extract out just the host part of the address.
- const size_t len = cp_pos - (address + 1);
- ACE_OS::memcpy (tmp_host, address + 1, len);
- tmp_host[len] = '\0';
- ipv6_in_host = true; // host string contains full IPv6 numeric address
- }
- }
-#endif /* ACE_HAS_IPV6 */
+ if (this->parse_address (address, addr, specified_hostname) == -1)
+ return -1;
- if (port_separator_loc == address)
+ if (specified_hostname.length() == 0)
{
// The address is a port number or port name. No hostname was
// specified. The hostname for each network interface and the
@@ -358,70 +320,7 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core,
if (this->probe_interfaces (orb_core) == -1)
return -1;
- // First convert the port into a usable form.
- if (addr.set (address + sizeof (':')) != 0)
- return -1;
-
- this->default_address_.set_port_number (addr.get_port_number ());
-
- // Now reset the port and set the host.
- if (addr.set (this->default_address_) != 0)
- return -1;
-
- return this->open_i (addr,
- reactor);
- }
- else if (port_separator_loc == 0)
- {
- // The address is a hostname. No port was specified, so assume
- // port zero (port will be chosen for us).
-#if defined (ACE_HAS_IPV6)
- if (ipv6_in_host)
- {
- if (addr.set ((unsigned short) 0, tmp_host) != 0)
- return -1;
-
- specified_hostname = tmp_host;
- }
- else
- {
-#endif /* ACE_HAS_IPV6 */
- if (addr.set ((unsigned short) 0, address) != 0)
- return -1;
-
- specified_hostname = address;
-#if defined (ACE_HAS_IPV6)
- }
-#endif /* ACE_HAS_IPV6 */
- }
- else
- {
-
- // Host and port were specified.
-#if defined (ACE_HAS_IPV6)
- if (ipv6_in_host)
- {
- u_short port =
- static_cast<u_short> (ACE_OS::atoi (port_separator_loc + sizeof (':')));
-
- if (addr.set (port, tmp_host) != 0)
- return -1;
- }
- else
- {
-#endif /* ACE_HAS_IPV6 */
- if (addr.set (address) != 0)
- return -1;
-
- // Extract out just the host part of the address.
- const size_t len = port_separator_loc - address;
- ACE_OS::memcpy (tmp_host, address, len);
- tmp_host[len] = '\0';
-#if defined (ACE_HAS_IPV6)
- }
-#endif /* ACE_HAS_IPV6 */
-
- specified_hostname = tmp_host;
+ return this->open_i (addr, reactor);
}
#if defined (ACE_HAS_IPV6)
@@ -444,7 +343,7 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - ")
ACE_TEXT ("IIOP_Acceptor::open, specified host=%s:%d\n"),
- (specified_hostname == 0 ? "<null>" : specified_hostname),
+ (specified_hostname.length() == 0 ? "<null>" : specified_hostname.c_str()),
addr.get_port_number ()));
}
@@ -476,7 +375,7 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core,
if (this->hostname (orb_core,
addr,
this->hosts_[0],
- specified_hostname) != 0)
+ specified_hostname.c_str()) != 0)
return -1;
// Copy the addr. The port is (re)set in
@@ -741,6 +640,126 @@ TAO_IIOP_Acceptor::hostname (TAO_ORB_Core *orb_core,
return 0;
}
+
+int
+TAO_IIOP_Acceptor::parse_address (const char *address,
+ ACE_INET_Addr &addr,
+ ACE_CString &specified_hostname)
+{
+ {
+ ACE_INET_Addr tmp;
+ addr.set (tmp);
+ specified_hostname.clear();
+ }
+
+ const char *port_separator_loc = ACE_OS::strchr (address, ':');
+ char tmp_host[MAXHOSTNAMELEN + 1];
+
+#if defined (ACE_HAS_IPV6)
+ // IPv6 numeric address in host string?
+ bool ipv6_in_host = false;
+
+
+ // Check if this is a (possibly) IPv6 supporting profile containing a
+ // numeric IPv6 address representation.
+ if ((this->version_.major > TAO_MIN_IPV6_IIOP_MAJOR ||
+ this->version_.minor >= TAO_MIN_IPV6_IIOP_MINOR) &&
+ address[0] == '[')
+ {
+ // In this case we have to find the end of the numeric address and
+ // start looking for the port separator from there.
+ const char *cp_pos = ACE_OS::strchr(address, ']');
+ if (cp_pos == 0)
+ {
+ // No valid IPv6 address specified.
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) - ")
+ ACE_TEXT ("IIOP_Acceptor::open, ")
+ ACE_TEXT ("Invalid IPv6 decimal address specified\n\n")),
+ -1);
+ }
+ else
+ {
+ if (cp_pos[1] == ':') // Look for a port
+ port_separator_loc = cp_pos + 1;
+ else
+ port_separator_loc = 0;
+ // Extract out just the host part of the address.
+ const size_t len = cp_pos - (address + 1);
+ ACE_OS::memcpy (tmp_host, address + 1, len);
+ tmp_host[len] = '\0';
+ ipv6_in_host = true; // host string contains full IPv6 numeric address
+ }
+ }
+#endif /* ACE_HAS_IPV6 */
+
+ if (port_separator_loc == address)
+ {
+ // First convert the port into a usable form.
+ if (addr.set (address + sizeof (':')) != 0)
+ return -1;
+
+ this->default_address_.set_port_number (addr.get_port_number ());
+
+ // Now reset the port and set the host.
+ if (addr.set (this->default_address_) != 0)
+ return -1;
+ }
+ else if (port_separator_loc == 0)
+ {
+ // The address is a hostname. No port was specified, so assume
+ // port zero (port will be chosen for us).
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ {
+ if (addr.set ((unsigned short) 0, tmp_host) != 0)
+ return -1;
+
+ specified_hostname = tmp_host;
+ }
+ else
+ {
+#endif /* ACE_HAS_IPV6 */
+ if (addr.set ((unsigned short) 0, address) != 0)
+ return -1;
+
+ specified_hostname = address;
+#if defined (ACE_HAS_IPV6)
+ }
+#endif /* ACE_HAS_IPV6 */
+ }
+ else
+ {
+ // Host and port were specified.
+#if defined (ACE_HAS_IPV6)
+ if (ipv6_in_host)
+ {
+ u_short port =
+ static_cast<u_short> (ACE_OS::atoi (port_separator_loc + sizeof (':')));
+
+ if (addr.set (port, tmp_host) != 0)
+ return -1;
+ }
+ else
+ {
+#endif /* ACE_HAS_IPV6 */
+ if (addr.set (address) != 0)
+ return -1;
+
+ // Extract out just the host part of the address.
+ const size_t len = port_separator_loc - address;
+ ACE_OS::memcpy (tmp_host, address, len);
+ tmp_host[len] = '\0';
+#if defined (ACE_HAS_IPV6)
+ }
+#endif /* ACE_HAS_IPV6 */
+ specified_hostname = tmp_host;
+ }
+
+ return 1;
+}
+
+
int
TAO_IIOP_Acceptor::dotted_decimal_address (ACE_INET_Addr &addr,
char *&host)
diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h
index 01aea0b40de..206c48be096 100644
--- a/TAO/tao/IIOP_Acceptor.h
+++ b/TAO/tao/IIOP_Acceptor.h
@@ -132,6 +132,16 @@ public:
protected:
/**
+ * Helper method
+ * Clear out 'addr' & 'specified_hostname' and initialize them
+ * based upon 'address'.
+ */
+ int
+ parse_address (const char *address,
+ ACE_INET_Addr &addr,
+ ACE_CString &specified_hostname);
+
+ /**
* Set the host name for the given address using the dotted decimal
* format.
*/
diff --git a/TAO/tao/Intrusive_Ref_Count_Handle_T.inl b/TAO/tao/Intrusive_Ref_Count_Handle_T.inl
index 1ca7c2767bb..a1ff0e5c12c 100644
--- a/TAO/tao/Intrusive_Ref_Count_Handle_T.inl
+++ b/TAO/tao/Intrusive_Ref_Count_Handle_T.inl
@@ -49,13 +49,8 @@ ACE_INLINE
TAO_Intrusive_Ref_Count_Handle<T>&
TAO_Intrusive_Ref_Count_Handle<T>::operator=(T* p)
{
- if (this->ptr_ != p)
- {
- this->drop();
- this->ptr_ = p;
- }
-
- return *this;
+ TAO_Intrusive_Ref_Count_Handle<T> tmp (p);
+ return this->operator= (tmp);
}