summaryrefslogtreecommitdiff
path: root/TAO/tao/Strategies/SHMIOP_Connector.cpp
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2002-04-12 19:43:25 +0000
committerbala <balanatarajan@users.noreply.github.com>2002-04-12 19:43:25 +0000
commit7b3700a7c380f1533b4367d999a303a9bfcba841 (patch)
treee7e885faf0922dc4062ebfc5041aa964e36aa88f /TAO/tao/Strategies/SHMIOP_Connector.cpp
parentd1ba71698652c9c25edd26dadb0a2f7a947323a0 (diff)
downloadATCD-7b3700a7c380f1533b4367d999a303a9bfcba841.tar.gz
ChangeLogTag: Fri Apr 12 14:14:01 2002 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Strategies/SHMIOP_Connector.cpp')
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connector.cpp130
1 files changed, 56 insertions, 74 deletions
diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp
index 14983eebd08..8b6f21e84c9 100644
--- a/TAO/tao/Strategies/SHMIOP_Connector.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp
@@ -116,9 +116,8 @@ TAO_SHMIOP_Connector::close (void)
}
int
-TAO_SHMIOP_Connector::connect (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc
- ACE_ENV_ARG_DECL_NOT_USED)
+TAO_SHMIOP_Connector::make_connect (TAO_GIOP_Invocation *invocation,
+ TAO_Transport_Descriptor_Interface *desc)
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
@@ -163,88 +162,71 @@ TAO_SHMIOP_Connector::connect (TAO_GIOP_Invocation *invocation,
TAO_SHMIOP_Connection_Handler *svc_handler = 0;
TAO_Transport *base_transport = 0;
- // Check the Cache first for connections
- // If transport found, reference count is incremented on assignment
- if (this->orb_core ()->lane_resources ().transport_cache ().find_transport (desc,
- base_transport) == 0)
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
+ ACE_TEXT ("making a new connection \n")));
+
+ // Purge connections (if necessary)
+ this->orb_core ()->lane_resources ().transport_cache ().purge ();
+
+ if (max_wait_time != 0)
{
- if (TAO_debug_level > 5)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
- ACE_TEXT ("got an existing transport with id %d \n"),
- base_transport->id ()));
+ ACE_Synch_Options synch_options (ACE_Synch_Options::USE_TIMEOUT,
+ *max_wait_time);
+
+ // We obtain the transport in the <svc_handler> variable. As
+ // we know now that the connection is not available in Cache
+ // we can make a new connection
+ result = this->base_connector_.connect (svc_handler,
+ remote_address,
+ synch_options);
}
else
{
- if (TAO_debug_level > 2)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
- ACE_TEXT ("making a new connection \n")));
-
- // Purge connections (if necessary)
- this->orb_core ()->lane_resources ().transport_cache ().purge ();
-
- // @@ This needs to change in the next round when we implement a
- // policy that will not allow new connections when a connection
- // is busy.
- if (max_wait_time != 0)
- {
- ACE_Synch_Options synch_options (ACE_Synch_Options::USE_TIMEOUT,
- *max_wait_time);
+ // We obtain the transport in the <svc_handler> variable. As
+ // we know now that the connection is not available in Cache
+ // we can make a new connection
+ result = this->base_connector_.connect (svc_handler,
+ remote_address);
+ }
- // We obtain the transport in the <svc_handler> variable. As
- // we know now that the connection is not available in Cache
- // we can make a new connection
- result = this->base_connector_.connect (svc_handler,
- remote_address,
- synch_options);
- }
- else
- {
- // We obtain the transport in the <svc_handler> variable. As
- // we know now that the connection is not available in Cache
- // we can make a new connection
- result = this->base_connector_.connect (svc_handler,
- remote_address);
- }
+ if (TAO_debug_level > 4)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
+ ACE_TEXT ("The result is <%d> \n"), result));
- if (TAO_debug_level > 4)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
- ACE_TEXT ("The result is <%d> \n"), result));
+ if (result == -1)
+ {
+ char buffer [MAXNAMELEN * 2];
+ endpoint->addr_to_string (buffer,
+ (MAXNAMELEN * 2) - 1);
- if (result == -1)
+ // Give users a clue to the problem.
+ if (TAO_debug_level > 0)
{
- char buffer [MAXNAMELEN * 2];
- endpoint->addr_to_string (buffer,
- (MAXNAMELEN * 2) - 1);
-
- // Give users a clue to the problem.
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_ERROR,
- ACE_TEXT ("(%P|%t) %s:%u, connection to ")
- ACE_TEXT ("%s failed (%p)\n"),
- __FILE__,
- __LINE__,
- buffer,
- ACE_TEXT ("errno")));
- }
- return -1;
+ ACE_DEBUG ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) %s:%u, connection to ")
+ ACE_TEXT ("%s failed (%p)\n"),
+ __FILE__,
+ __LINE__,
+ buffer,
+ ACE_TEXT ("errno")));
}
+ return -1;
+ }
- base_transport = TAO_Transport::_duplicate (svc_handler->transport ());
- // Add the handler to Cache
- int retval =
- this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc,
- svc_handler->transport ());
+ base_transport = TAO_Transport::_duplicate (svc_handler->transport ());
+ // Add the handler to Cache
+ int retval =
+ this->orb_core ()->lane_resources ().transport_cache ().cache_transport (desc,
+ svc_handler->transport ());
- if (retval != 0 && TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
- ACE_TEXT ("could not add the new connection to Cache \n")));
- }
+ if (retval != 0 && TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
+ ACE_TEXT ("could not add the new connection to Cache \n")));
}
// No need to _duplicate and release since base_transport