summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorvridosh <vridosh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-07-20 15:17:19 +0000
committervridosh <vridosh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-07-20 15:17:19 +0000
commit98106d4faf23f753d4f5f14e9ab31bdaabbb897b (patch)
tree3cb655b1c91224b0deaf6bf641d7819bfabfdefe /TAO
parenteefa469cd07f1c9b639271442de780ef92a1ca73 (diff)
downloadATCD-98106d4faf23f753d4f5f14e9ab31bdaabbb897b.tar.gz
ChangeLogTag: Fri Jul 20 15:03:14 UTC 2007 Vadym Ridosh <vridosh@prismtech.com>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog14
-rw-r--r--TAO/tao/Strategies/DIOP_Acceptor.cpp26
-rw-r--r--TAO/tao/Strategies/DIOP_Connection_Handler.cpp50
-rw-r--r--TAO/tao/Strategies/DIOP_Connection_Handler.h10
-rw-r--r--TAO/tao/Strategies/DIOP_Connector.cpp8
-rw-r--r--TAO/tao/Strategies/DIOP_Transport.cpp4
-rw-r--r--TAO/tao/Strategies/DIOP_Transport.h6
7 files changed, 57 insertions, 61 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 79db967d55b..0da2dc419aa 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,17 @@
+Fri Jul 20 15:03:14 UTC 2007 Vadym Ridosh <vridosh@prismtech.com>
+
+ * tao/Strategies/DIOP_Connector.cpp:
+ * tao/Strategies/DIOP_Transport.cpp:
+ * tao/Strategies/DIOP_Acceptor.cpp:
+ * tao/Strategies/DIOP_Connection_Handler.h:
+ * tao/Strategies/DIOP_Connection_Handler.cpp:
+ * tao/Strategies/DIOP_Transport.h:
+ Fixed potential memory leaks while DIOP_Connection_Handler
+ is being created in DIOP_Acceptor::open_i and
+ DIOP_Connector::make_connection. Made DIOP even more look
+ like IIOP. Fixed warning genereated by MS VS in
+ DIOP_Acceptor::parse_options.
+
Fri Jul 20 09:42:40 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
* examples/POA/Forwarding/*:
diff --git a/TAO/tao/Strategies/DIOP_Acceptor.cpp b/TAO/tao/Strategies/DIOP_Acceptor.cpp
index d559f5ec223..d0ec021bd50 100644
--- a/TAO/tao/Strategies/DIOP_Acceptor.cpp
+++ b/TAO/tao/Strategies/DIOP_Acceptor.cpp
@@ -239,7 +239,7 @@ TAO_DIOP_Acceptor::is_collocated (const TAO_Endpoint *endpoint)
int
TAO_DIOP_Acceptor::close (void)
{
- return 0;
+ return this->connection_handler_->peer ().close ();
}
int
@@ -405,14 +405,23 @@ TAO_DIOP_Acceptor::open_i (const ACE_INET_Addr& addr,
-1);
this->connection_handler_->local_addr (addr);
- this->connection_handler_->open_server ();
+ int result = this->connection_handler_->open_server ();
+ if (result == -1)
+ {
+ delete this->connection_handler_;
+ return result;
+ }
// Register only with a valid handle
- int const result =
+ result =
reactor->register_handler (this->connection_handler_,
ACE_Event_Handler::READ_MASK);
if (result == -1)
- return result;
+ {
+ this->connection_handler_->close ();
+ delete this->connection_handler_;
+ return result;
+ }
// Connection handler ownership now belongs to the Reactor.
this->connection_handler_->remove_reference ();
@@ -421,7 +430,7 @@ TAO_DIOP_Acceptor::open_i (const ACE_INET_Addr& addr,
// We do this make sure the port number the endpoint is listening on
// gets set in the addr.
- if (this->connection_handler_->dgram ().get_local_addr (address) != 0)
+ if (this->connection_handler_->peer ().get_local_addr (address) != 0)
{
if (TAO_debug_level > 0)
ACE_ERROR ((LM_ERROR,
@@ -953,7 +962,6 @@ TAO_DIOP_Acceptor::object_key (IOP::TaggedProfile &profile,
return 1;
}
-
int
TAO_DIOP_Acceptor::parse_options (const char *str)
{
@@ -971,9 +979,7 @@ TAO_DIOP_Acceptor::parse_options (const char *str)
static const char option_delimiter = '&';
// Count the number of options.
-
- CORBA::ULong option_count = 1;
- // Number of endpoints in the string (initialized to 1).
+ int option_count = 1;
// Only check for endpoints after the protocol specification and
// before the object key.
@@ -992,7 +998,7 @@ TAO_DIOP_Acceptor::parse_options (const char *str)
ACE_CString::size_type begin = 0;
ACE_CString::size_type end = 0;
- for (CORBA::ULong j = 0; j < option_count; ++j)
+ for (int j = 0; j < option_count; ++j)
{
if (j < option_count - 1)
end = options.find (option_delimiter, begin);
diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp
index f6c8c347ceb..26bc62bfb99 100644
--- a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp
+++ b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp
@@ -40,7 +40,6 @@ TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (ACE_Thread_Manager *t)
ACE_ASSERT (0);
}
-
TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core)
: TAO_DIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
TAO_Connection_Handler (orb_core),
@@ -54,7 +53,6 @@ TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core
this->transport (specific_transport);
}
-
TAO_DIOP_Connection_Handler::~TAO_DIOP_Connection_Handler (void)
{
delete this->transport ();
@@ -68,50 +66,32 @@ TAO_DIOP_Connection_Handler::~TAO_DIOP_Connection_Handler (void)
ACE_TEXT ("~DIOP_Connection_Handler, ")
ACE_TEXT ("release_os_resources() failed %m\n")));
}
- this->udp_socket_.close ();
}
// DIOP Additions - Begin
-ACE_HANDLE
-TAO_DIOP_Connection_Handler::get_handle (void) const
-{
- return this->udp_socket_.get_handle ();
-}
-
-
const ACE_INET_Addr &
TAO_DIOP_Connection_Handler::addr (void)
{
return this->addr_;
}
-
void
TAO_DIOP_Connection_Handler::addr (const ACE_INET_Addr &addr)
{
this->addr_ = addr;
}
-
const ACE_INET_Addr &
TAO_DIOP_Connection_Handler::local_addr (void)
{
return this->local_addr_;
}
-
void
TAO_DIOP_Connection_Handler::local_addr (const ACE_INET_Addr &addr)
{
this->local_addr_ = addr;
}
-
-
-const ACE_SOCK_Dgram &
-TAO_DIOP_Connection_Handler::dgram (void)
-{
- return this->udp_socket_;
-}
// DIOP Additions - End
int
@@ -152,9 +132,9 @@ TAO_DIOP_Connection_Handler::open (void*)
}
}
- this->udp_socket_.open (this->local_addr_);
+ this->peer ().open (this->local_addr_);
- if (this->set_socket_option (this->udp_socket_,
+ if (this->set_socket_option (this->peer (),
protocol_properties.send_buffer_size_,
protocol_properties.recv_buffer_size_) == -1)
return -1;
@@ -171,7 +151,7 @@ TAO_DIOP_Connection_Handler::open (void*)
// Set that the transport is now connected, if fails we return -1
// Use C-style cast b/c otherwise we get warnings on lots of
// compilers
- if (!this->transport ()->post_open ((size_t) this->get_handle ()))
+ if (!this->transport ()->post_open ((size_t) this->peer ().get_handle ()))
return -1;
this->state_changed (TAO_LF_Event::LFS_SUCCESS,
@@ -212,9 +192,9 @@ TAO_DIOP_Connection_Handler::open_server (void)
}
}
- this->udp_socket_.open (this->local_addr_);
+ this->peer ().open (this->local_addr_);
- if (this->set_socket_option (this->udp_socket_,
+ if (this->set_socket_option (this->peer (),
protocol_properties.send_buffer_size_,
protocol_properties.recv_buffer_size_) == -1)
return -1;
@@ -229,7 +209,7 @@ TAO_DIOP_Connection_Handler::open_server (void)
));
}
- this->transport ()->id ((size_t) this->get_handle ());
+ this->transport ()->id ((size_t) this->peer ().get_handle ());
return 0;
}
@@ -331,7 +311,7 @@ TAO_DIOP_Connection_Handler::set_tos (int tos)
int result = 0;
#if defined (ACE_HAS_IPV6)
ACE_INET_Addr local_addr;
- if (this->dgram ().get_local_addr (local_addr) == -1)
+ if (this->peer ().get_local_addr (local_addr) == -1)
return -1;
else if (local_addr.get_type () == AF_INET6)
# if !defined (IPV6_TCLASS)
@@ -347,17 +327,17 @@ TAO_DIOP_Connection_Handler::set_tos (int tos)
return 0;
}
# else /* !IPV6_TCLASS */
- result = this->dgram ().set_option (IPPROTO_IPV6,
- IPV6_TCLASS,
- (int *) &tos ,
- (int) sizeof (tos));
+ result = this->peer ().set_option (IPPROTO_IPV6,
+ IPV6_TCLASS,
+ (int *) &tos ,
+ (int) sizeof (tos));
else
# endif /* IPV6_TCLASS */
#endif /* ACE_HAS_IPV6 */
- result = this->dgram ().set_option (IPPROTO_IP,
- IP_TOS,
- (int *) &tos ,
- (int) sizeof (tos));
+ result = this->peer ().set_option (IPPROTO_IP,
+ IP_TOS,
+ (int *) &tos ,
+ (int) sizeof (tos));
if (TAO_debug_level)
{
diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.h b/TAO/tao/Strategies/DIOP_Connection_Handler.h
index fd5336a5de7..fd910d0ced8 100644
--- a/TAO/tao/Strategies/DIOP_Connection_Handler.h
+++ b/TAO/tao/Strategies/DIOP_Connection_Handler.h
@@ -103,8 +103,6 @@ public:
*
*/
//@{
- ACE_HANDLE get_handle (void) const;
-
const ACE_INET_Addr &addr (void);
void addr (const ACE_INET_Addr &addr);
@@ -112,12 +110,6 @@ public:
const ACE_INET_Addr &local_addr (void);
void local_addr (const ACE_INET_Addr &addr);
-
- const ACE_INET_Addr &server_addr (void);
-
- void server_addr (const ACE_INET_Addr &addr);
-
- const ACE_SOCK_Dgram &dgram (void);
//@}
// DIOP Additions - End
@@ -143,8 +135,6 @@ protected:
*
*/
//@{
- ACE_SOCK_Dgram udp_socket_;
-
/// This is always the remote address
ACE_INET_Addr addr_;
diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp
index b4ae02e12ce..5389a4fbd9e 100644
--- a/TAO/tao/Strategies/DIOP_Connector.cpp
+++ b/TAO/tao/Strategies/DIOP_Connector.cpp
@@ -158,6 +158,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
ACE_TEXT ("could not make a new connection\n")));
}
+ delete svc_handler;
return 0;
}
@@ -165,7 +166,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - DIOP_Connector::connect, ")
ACE_TEXT ("new connection on HANDLE %d\n"),
- svc_handler->get_handle ()));
+ svc_handler->peer ().get_handle ()));
TAO_DIOP_Transport *transport =
dynamic_cast <TAO_DIOP_Transport *> (svc_handler->transport ());
@@ -173,6 +174,9 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
// In case of errors transport is zero
if (transport == 0)
{
+ // Close the handler.
+ svc_handler->close ();
+
// Give users a clue to the problem.
if (TAO_debug_level > 3)
ACE_DEBUG ((LM_ERROR,
@@ -182,6 +186,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
diop_endpoint->port (),
ACE_TEXT ("errno")));
+ delete svc_handler;
return 0;
}
@@ -203,6 +208,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *,
ACE_TEXT ("could not add the new connection to cache\n")));
}
+ delete svc_handler;
return 0;
}
diff --git a/TAO/tao/Strategies/DIOP_Transport.cpp b/TAO/tao/Strategies/DIOP_Transport.cpp
index 54fd7904e3f..96576104b2e 100644
--- a/TAO/tao/Strategies/DIOP_Transport.cpp
+++ b/TAO/tao/Strategies/DIOP_Transport.cpp
@@ -80,7 +80,7 @@ TAO_DIOP_Transport::send (iovec *iov, int iovcnt,
for (int i = 0; i < iovcnt; i++)
bytes_to_send += iov[i].iov_len;
- this->connection_handler_->dgram ().send (iov, iovcnt, addr);
+ this->connection_handler_->peer ().send (iov, iovcnt, addr);
// @@ Michael:
// Always return a positive number of bytes sent, as we do
@@ -98,7 +98,7 @@ TAO_DIOP_Transport::recv (char *buf,
{
ACE_INET_Addr from_addr;
- ssize_t const n = this->connection_handler_->dgram ().recv (buf, len, from_addr);
+ ssize_t const n = this->connection_handler_->peer ().recv (buf, len, from_addr);
if (TAO_debug_level > 0)
{
diff --git a/TAO/tao/Strategies/DIOP_Transport.h b/TAO/tao/Strategies/DIOP_Transport.h
index 1c4c0cb6b3a..6ce86699409 100644
--- a/TAO/tao/Strategies/DIOP_Transport.h
+++ b/TAO/tao/Strategies/DIOP_Transport.h
@@ -25,11 +25,11 @@
#include "tao/Strategies/strategies_export.h"
#include "tao/Transport.h"
-#include "ace/SOCK_Stream.h"
+#include "ace/SOCK_Dgram.h"
#include "ace/Svc_Handler.h"
#if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
-template class TAO_Strategies_Export ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
+template class TAO_Strategies_Export ACE_Svc_Handler<ACE_SOCK_DGRAM, ACE_NULL_SYNCH>;
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -42,7 +42,7 @@ class TAO_Pluggable_Messaging;
class TAO_Acceptor;
// Service Handler for this transport
-typedef ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+typedef ACE_Svc_Handler<ACE_SOCK_DGRAM, ACE_NULL_SYNCH>
TAO_DIOP_SVC_HANDLER;
/**