summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2002-11-30 00:34:06 +0000
committerbala <balanatarajan@users.noreply.github.com>2002-11-30 00:34:06 +0000
commitb12c9d93903c928f16806e28d1c2208a939d615c (patch)
treec7979d1496b35bec02dd20fed2c8beed6e91d7e4
parent793166c1a6788ef3a04d2d9a2092ee088e036d7f (diff)
downloadATCD-b12c9d93903c928f16806e28d1c2208a939d615c.tar.gz
ChangeLogTag: Fri Nov 29 19:30:20 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog18
-rw-r--r--TAO/tao/Blocked_Connect_Strategy.cpp16
-rw-r--r--TAO/tao/Blocked_Connect_Strategy.h2
-rw-r--r--TAO/tao/Connect_Strategy.cpp10
-rw-r--r--TAO/tao/Connect_Strategy.h7
-rw-r--r--TAO/tao/IIOP_Connector.cpp3
6 files changed, 55 insertions, 1 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 2533b944571..73bf1f5266d 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,21 @@
+Fri Nov 29 19:30:20 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
+
+ * tao/Connect_Strategy.h:
+ * tao/Connect_Strategy.cpp: Added a new method post_failed_connect
+ () which could be used to do cleanup if the connect () call
+ fails.
+
+ * tao/Blocked_Connect_Strategy.h:
+ * tao/Blocked_Connect_Strategy.cpp: Implemented the
+ post_failed_connect () method to do cleanup of the svc_handler
+ created. Since the blocked connect strategy doesnt use the
+ reactor, and hence no handle_close () call if connection
+ establishment fails, we need to employ a seperate mechanism to
+ take care of cleanup. This fixes a memory leak.
+
+ * tao/IIOP_Connector.cpp: Call post_failed_connect () if the
+ connect () call fails.
+
Fri Nov 29 19:25:59 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
* tao/Transport.cpp: Prevented the thread doing the server side
diff --git a/TAO/tao/Blocked_Connect_Strategy.cpp b/TAO/tao/Blocked_Connect_Strategy.cpp
index 431f3ab424b..37cf91e9efa 100644
--- a/TAO/tao/Blocked_Connect_Strategy.cpp
+++ b/TAO/tao/Blocked_Connect_Strategy.cpp
@@ -1,4 +1,5 @@
#include "Blocked_Connect_Strategy.h"
+#include "Connection_Handler.h"
#include "ace/Synch_Options.h"
@@ -44,3 +45,18 @@ TAO_Blocked_Connect_Strategy::wait (TAO_Connection_Handler *,
// We cannot wait for connection completion
return -1;
}
+
+int
+TAO_Blocked_Connect_Strategy::post_failed_connect (TAO_Connection_Handler *ch)
+{
+ // We need to do this here else we will leak memory. We cannot call
+ // close_connection () for the following reasons
+ // . in blocked connect the event_handlers get_handle () will return
+ // an ACE_INVALID_HANDLE
+ // . We cannot relax the conditions since the conditions are right
+ // for other natural cases ie. LF
+ // Hence the blocked startegy will have to take of things itself.
+ ch->transport (0);
+ int ref = ch->decr_refcount ();
+ return ref;
+}
diff --git a/TAO/tao/Blocked_Connect_Strategy.h b/TAO/tao/Blocked_Connect_Strategy.h
index 23b1d71d1e2..cefe6989442 100644
--- a/TAO/tao/Blocked_Connect_Strategy.h
+++ b/TAO/tao/Blocked_Connect_Strategy.h
@@ -46,6 +46,8 @@ public:
virtual int wait (TAO_Connection_Handler *ch,
ACE_Time_Value *val);
+
+ virtual int post_failed_connect (TAO_Connection_Handler *ch);
};
diff --git a/TAO/tao/Connect_Strategy.cpp b/TAO/tao/Connect_Strategy.cpp
index d4b04328118..85e6cd3d641 100644
--- a/TAO/tao/Connect_Strategy.cpp
+++ b/TAO/tao/Connect_Strategy.cpp
@@ -1,7 +1,9 @@
#include "Connect_Strategy.h"
-ACE_RCSID(tao, Connect_Strategy, "$Id$")
+ACE_RCSID(tao,
+ Connect_Strategy,
+ "$Id$")
TAO_Connect_Strategy::TAO_Connect_Strategy (TAO_ORB_Core *orb_core)
: orb_core_ (orb_core)
@@ -12,3 +14,9 @@ TAO_Connect_Strategy::TAO_Connect_Strategy (TAO_ORB_Core *orb_core)
TAO_Connect_Strategy::~TAO_Connect_Strategy (void)
{
}
+
+int
+TAO_Connect_Strategy::post_failed_connect (TAO_Connection_Handler * /*ch*/)
+{
+ return 0;
+}
diff --git a/TAO/tao/Connect_Strategy.h b/TAO/tao/Connect_Strategy.h
index b6c68798f94..6638f118511 100644
--- a/TAO/tao/Connect_Strategy.h
+++ b/TAO/tao/Connect_Strategy.h
@@ -65,6 +65,13 @@ public:
*/
virtual int wait (TAO_Connection_Handler *ch,
ACE_Time_Value *val) = 0;
+
+ /*
+ * Do any left over memory management or related things after
+ * the connect failed.
+ */
+ virtual int post_failed_connect (TAO_Connection_Handler *ch);
+
protected:
/// Cached copy of the ORB core pointer
diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp
index 7d963a2ed7d..0f3a1cbebcf 100644
--- a/TAO/tao/IIOP_Connector.cpp
+++ b/TAO/tao/IIOP_Connector.cpp
@@ -211,6 +211,9 @@ TAO_IIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
iiop_endpoint->host (), iiop_endpoint->port (),
"errno"));
}
+
+ this->active_connect_strategy_->post_failed_connect (svc_handler);
+
return -1;
}