summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2002-10-31 21:20:51 +0000
committerbala <balanatarajan@users.noreply.github.com>2002-10-31 21:20:51 +0000
commit9cd112b83a72260017ed5527e62bc580e339f82d (patch)
tree5ffca13d32bfe27961be8b7df487929657d861e4 /TAO/tao
parenta7b2e21247b1e74c3b2bc1f7a36da7465db2891b (diff)
downloadATCD-9cd112b83a72260017ed5527e62bc580e339f82d.tar.gz
ChangeLogTag:Thu Oct 31 14:48:39 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/IIOP_Connector.cpp22
-rw-r--r--TAO/tao/IIOP_Connector.h3
-rw-r--r--TAO/tao/Invocation.cpp52
-rw-r--r--TAO/tao/Strategies/DIOP_Connector.cpp3
-rw-r--r--TAO/tao/Strategies/DIOP_Connector.h3
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connector.cpp7
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connector.h3
-rw-r--r--TAO/tao/Strategies/UIOP_Connector.cpp8
-rw-r--r--TAO/tao/Strategies/UIOP_Connector.h3
-rw-r--r--TAO/tao/Transport_Connector.cpp20
-rw-r--r--TAO/tao/Transport_Connector.h16
11 files changed, 84 insertions, 56 deletions
diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp
index fcbdfe29e52..86c529774ee 100644
--- a/TAO/tao/IIOP_Connector.cpp
+++ b/TAO/tao/IIOP_Connector.cpp
@@ -143,7 +143,8 @@ TAO_IIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
int
TAO_IIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc)
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *max_wait_time)
{
TAO_IIOP_Endpoint *iiop_endpoint =
this->remote_endpoint (desc->endpoint ());
@@ -160,23 +161,6 @@ TAO_IIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
"to <%s:%d>\n",
iiop_endpoint->host(), iiop_endpoint->port()));
-
- // Get the max_wait_time
- ACE_Time_Value *max_wait_time = 0;
-
- ACE_Time_Value connection_timeout;
- int timeout = 0;
-
- this->orb_core ()->connection_timeout (invocation->stub (),
- timeout,
- connection_timeout);
- if (!timeout)
- max_wait_time =
- invocation->max_wait_time ();
- else
- max_wait_time = &connection_timeout;
-
-
// Get the right synch options
ACE_Synch_Options synch_options;
@@ -369,7 +353,7 @@ TAO_IIOP_Connector::init_tcp_properties (void)
tph->call_client_protocols_hook (send_buffer_size,
recv_buffer_size,
no_delay,
- enable_network_priority,
+ enable_network_priority,
protocol_type);
if(hook_result == -1)
diff --git a/TAO/tao/IIOP_Connector.h b/TAO/tao/IIOP_Connector.h
index bfed63f2fc1..0fb2f3c48f1 100644
--- a/TAO/tao/IIOP_Connector.h
+++ b/TAO/tao/IIOP_Connector.h
@@ -86,7 +86,8 @@ protected:
int set_validate_endpoint (TAO_Endpoint *ep);
int make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc);
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout = 0);
/// More TAO_Connector methods, please check the documentation on
/// Transport_Connector.h
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index c48ddbe44d2..caeb5237c1c 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -255,20 +255,56 @@ TAO_GIOP_Invocation::perform_call (TAO_Transport_Descriptor_Interface &desc
1);
}
+ // Get the max_wait_time
+ ACE_Time_Value *max_wait_time = 0;
+
+ ACE_Time_Value connection_timeout;
+ int is_conn_timeout = 0;
+
+ // Check for the connection timout policy in the ORB
+ this->orb_core ()->connection_timeout (this->stub (),
+ is_conn_timeout,
+ connection_timeout);
+
+ // If a connection timeout policy is set, use that as the timeout
+ // value.
+ if (!is_conn_timeout)
+ max_wait_time =
+ this->max_wait_time ();
+ else
+ max_wait_time = &connection_timeout;
+
// Obtain a connection.
int result =
conn_reg->get_connector (desc.endpoint ())->connect (this,
- &desc
+ &desc,
+ max_wait_time
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (-1);
- if (result == 0)
+ // A timeout error occurred
+ if (result == -1 && errno == ETIME)
+ {
+ // If the user has set a roundtrip timeout policy, then throw a
+ // timeout exception, else just fall through and return 0 to
+ // look at the next endpoint
+ if (!is_conn_timeout)
+ {
+ ACE_THROW_RETURN (CORBA::TIMEOUT (
+ CORBA_SystemException::_tao_minor_code (
+ TAO_TIMEOUT_CONNECT_MINOR_CODE,
+ errno),
+ CORBA::COMPLETED_NO),
+ 1);
+ }
+ }
+ else if (result == 0)
{
// Now that we have the client connection handler object we need to
// set the right messaging protocol for in the client side transport.
const TAO_GIOP_Message_Version& version = this->profile_->version ();
result = this->transport_->messaging_init (version.major,
- version.minor);
+ version.minor);
// Set the giop version of the out stream
this->out_stream_.set_version (version.major, version.minor);
@@ -286,16 +322,6 @@ TAO_GIOP_Invocation::perform_call (TAO_Transport_Descriptor_Interface &desc
return 1;
}
- if (errno == ETIME)
- {
- ACE_THROW_RETURN (CORBA::TIMEOUT (
- CORBA_SystemException::_tao_minor_code (
- TAO_TIMEOUT_CONNECT_MINOR_CODE,
- errno),
- CORBA::COMPLETED_NO),
- 1);
- }
-
// Update the remaining time for this call.
this->countdown_->update ();
diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp
index 223a273fa23..cdfa8da9826 100644
--- a/TAO/tao/Strategies/DIOP_Connector.cpp
+++ b/TAO/tao/Strategies/DIOP_Connector.cpp
@@ -128,7 +128,8 @@ TAO_DIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
int
TAO_DIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc)
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value * /*max_wait_time*/)
{
TAO_Transport *&transport = invocation->transport ();
diff --git a/TAO/tao/Strategies/DIOP_Connector.h b/TAO/tao/Strategies/DIOP_Connector.h
index 07497babcf2..ca430e805b6 100644
--- a/TAO/tao/Strategies/DIOP_Connector.h
+++ b/TAO/tao/Strategies/DIOP_Connector.h
@@ -78,7 +78,8 @@ protected:
int set_validate_endpoint (TAO_Endpoint *ep);
int make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc);
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout = 0);
virtual TAO_Profile * make_profile (ACE_ENV_SINGLE_ARG_DECL);
//@}
diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp
index 82fe18aa5c3..b7dbdb85a09 100644
--- a/TAO/tao/Strategies/SHMIOP_Connector.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp
@@ -160,7 +160,8 @@ TAO_SHMIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
int
TAO_SHMIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc)
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *max_wait_time)
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
@@ -184,10 +185,6 @@ TAO_SHMIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ")
ACE_TEXT ("making a new connection \n")));
- ACE_Time_Value *max_wait_time =
- invocation->max_wait_time ();
-
-
// Get the right synch options
ACE_Synch_Options synch_options;
diff --git a/TAO/tao/Strategies/SHMIOP_Connector.h b/TAO/tao/Strategies/SHMIOP_Connector.h
index 0abfe668f9f..e2f3a064184 100644
--- a/TAO/tao/Strategies/SHMIOP_Connector.h
+++ b/TAO/tao/Strategies/SHMIOP_Connector.h
@@ -97,7 +97,8 @@ protected:
int set_validate_endpoint (TAO_Endpoint *endpoint);
int make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc);
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout = 0);
virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL);
//@}
diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp
index b591352caca..c53c225a0c6 100644
--- a/TAO/tao/Strategies/UIOP_Connector.cpp
+++ b/TAO/tao/Strategies/UIOP_Connector.cpp
@@ -145,7 +145,8 @@ TAO_UIOP_Connector::set_validate_endpoint (TAO_Endpoint *endpoint)
int
TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc)
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *max_wait_time)
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
@@ -166,9 +167,6 @@ TAO_UIOP_Connector::make_connection (TAO_GIOP_Invocation *invocation,
ACE_TEXT ("(%P|%t) UIOP_Connector::connect ")
ACE_TEXT ("making a new connection \n")));
- ACE_Time_Value *max_wait_time =
- invocation->max_wait_time ();
-
ACE_Synch_Options synch_options;
this->active_connect_strategy_->synch_options (max_wait_time,
@@ -354,7 +352,7 @@ TAO_UIOP_Connector::init_uiop_properties (void)
tph->call_client_protocols_hook (send_buffer_size,
recv_buffer_size,
no_delay,
- enable_network_priority,
+ enable_network_priority,
protocol_type);
if(hook_result == -1)
diff --git a/TAO/tao/Strategies/UIOP_Connector.h b/TAO/tao/Strategies/UIOP_Connector.h
index 528c79aa341..e3c3b5f8e58 100644
--- a/TAO/tao/Strategies/UIOP_Connector.h
+++ b/TAO/tao/Strategies/UIOP_Connector.h
@@ -101,7 +101,8 @@ protected:
int set_validate_endpoint (TAO_Endpoint *endpoint);
int make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc);
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout = 0);
virtual TAO_Profile *make_profile (ACE_ENV_SINGLE_ARG_DECL);
diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp
index 665811fe098..2e65ddcd221 100644
--- a/TAO/tao/Transport_Connector.cpp
+++ b/TAO/tao/Transport_Connector.cpp
@@ -210,15 +210,30 @@ TAO_Connector::make_mprofile (const char *string,
int
TAO_Connector::connect (TAO_GIOP_Invocation *invocation,
TAO_Transport_Descriptor_Interface *desc
+ ACE_ENV_ARG_DECL)
+{
+ return this->connect (invocation,
+ desc,
+ 0
+ ACE_ENV_ARG_PARAMETER);
+}
+
+int
+TAO_Connector::connect (TAO_GIOP_Invocation *invocation,
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout
ACE_ENV_ARG_DECL_NOT_USED)
{
if (this->set_validate_endpoint (desc->endpoint ()) == -1)
return -1;
+
TAO_Transport *base_transport = 0;
// Check the Cache first for connections
// If transport found, reference count is incremented on assignment
+ // @@todo: We need to send the timeout value to the cache registry
+ // too. That should be the next step!
if (this->orb_core ()->lane_resources ().transport_cache ().find_transport (desc,
base_transport) == 0)
{
@@ -235,7 +250,7 @@ TAO_Connector::connect (TAO_GIOP_Invocation *invocation,
// base_transport.
transport = base_transport;
- // Succesful
+ // Successfull
return 0;
}
@@ -244,7 +259,8 @@ TAO_Connector::connect (TAO_GIOP_Invocation *invocation,
this->orb_core_->lane_resources ().transport_cache ().purge ();
return this->make_connection (invocation,
- desc);
+ desc,
+ timeout);
}
diff --git a/TAO/tao/Transport_Connector.h b/TAO/tao/Transport_Connector.h
index 8ca927cdb12..6e30d8f71a0 100644
--- a/TAO/tao/Transport_Connector.h
+++ b/TAO/tao/Transport_Connector.h
@@ -81,12 +81,13 @@ public:
TAO_Transport_Descriptor_Interface *desc
ACE_ENV_ARG_DECL);
- /// Initial set of connections to be established.
- /*
- @@ TODO: Need to be removed from the ORB. People who need this
- could use _validate_connections () instead.
- virtual int preconnect (const char *preconnections) = 0;
- */
+ /**
+ * Call is very similar to the previous one but with a timeout.
+ */
+ virtual int connect (TAO_GIOP_Invocation *invocation,
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout
+ ACE_ENV_ARG_DECL);
/// Create a profile for this protocol and initialize it based on the
/// encapsulation in <cdr>
@@ -111,7 +112,8 @@ protected:
/// Do an actual connect using the underlying transport to make a
/// connection
virtual int make_connection (TAO_GIOP_Invocation *invocation,
- TAO_Transport_Descriptor_Interface *desc) = 0;
+ TAO_Transport_Descriptor_Interface *desc,
+ ACE_Time_Value *timeout) = 0;
/// Set the ORB Core pointer
void orb_core (TAO_ORB_Core *orb_core);