summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-29 22:59:21 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-29 22:59:21 +0000
commita3683e0284b8c734a85eccc945bb8146ce67a45d (patch)
treecd0c0cfc4a2c5283b4feece6400bf70e00d036b4
parent9f4b60aadddaa169aa8a7a981426ff72ee53a429 (diff)
downloadATCD-a3683e0284b8c734a85eccc945bb8146ce67a45d.tar.gz
ChangeLogTag:Sat May 29 17:56:53 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-99c17
-rw-r--r--TAO/tao/Invocation.cpp25
-rw-r--r--TAO/tao/ORB_Core.cpp23
-rw-r--r--TAO/tao/Wait_Strategy.cpp57
-rw-r--r--TAO/tests/MT_Client/test_i.cpp11
5 files changed, 94 insertions, 39 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index ebcd43c2ae1..45dc670ed1f 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,20 @@
+Sat May 29 17:56:53 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/Wait_Strategy.cpp:
+ If an error is received while waiting for a reply we must wakeup
+ the follower thread (unless we are the leader).
+ After waking up we should check if it was because of an error or
+ actually all the data arrived.
+
+ * tao/Invocation.cpp:
+ Errors while receiving a reply where not handled correctly.
+
+ * tao/ORB_Core.cpp:
+ Use ACE_GUARD instead of ACE_Guard<>.
+
+ * tests/MT_Client/test_i.cpp:
+ Remove excessive debugging messages.
+
Sat May 29 16:56:05 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
* tao/Connect.h:
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 49aa708da10..f279997ea0e 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -700,9 +700,13 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
retval = this->transport_->bind_reply_dispatcher (this->request_id_,
&this->rd_);
if (retval == -1)
- ACE_THROW_RETURN (CORBA::INTERNAL (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_MAYBE),
- -1);
+ {
+ // @@ What is the right way to handle this error?
+ this->close_connection ();
+ ACE_THROW_RETURN (CORBA::INTERNAL (TAO_DEFAULT_MINOR_CODE,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_EXCEPTION);
+ }
// This blocks until the response is read. In the current version,
// there is only one client thread that ever uses this connection,
@@ -763,8 +767,17 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
// Wait for the reply. We should wait till we receive the reply
// fully.
// @@ Check for return value -1 here !!! (Alex).
- while (!this->transport_->message_received ())
- this->transport_->wait_for_reply ();
+ int reply_error = 0;
+ while (!this->transport_->message_received () && reply_error == 0)
+ reply_error = this->transport_->wait_for_reply ();
+
+ if (reply_error == -1)
+ {
+ this->close_connection ();
+ ACE_THROW_RETURN (CORBA::COMM_FAILURE (TAO_DEFAULT_MINOR_CODE,
+ CORBA::COMPLETED_MAYBE),
+ TAO_INVOKE_EXCEPTION);
+ }
// @@ Alex: the old version of this had some error handling code,
// like: this->profile_->reset_hint ()
@@ -791,7 +804,7 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
case TAO_GIOP_SYSTEM_EXCEPTION:
{
- // Demarshal the system exception and raise it!
+ // Demarshal the system exception and raise it!
return TAO_INVOKE_EXCEPTION;
}
// NOTREACHED.
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 5a893913a27..0b6985da2dc 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -70,8 +70,8 @@ TAO_ORB_Core::add_to_ior_table (ACE_CString init_ref, TAO_IOR_LookupTable &table
int index = 0;
if ((index = init_ref.find ("=")) == ACE_CString::npos)
ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to parse -ORBInitRef parameter\n"),
- -1);
+ "Unable to parse -ORBInitRef parameter\n"),
+ -1);
ACE_CString object_id = init_ref.substr (0,index);
ACE_CString ior = init_ref.substr (index+1);
@@ -137,8 +137,8 @@ TAO_ORB_Core::init (int &argc, char *argv[])
TAO_IOR_LookupTable *ior_lookup_table;
ACE_NEW_RETURN (ior_lookup_table,
- TAO_IOR_LookupTable,
- -1);
+ TAO_IOR_LookupTable,
+ -1);
// List of comma separated prefixes from ORBDefaultInitRef.
ACE_CString default_init_ref;
@@ -428,21 +428,21 @@ TAO_ORB_Core::init (int &argc, char *argv[])
{
init_ref = arg_shifter.get_current ();
if (this->add_to_ior_table (init_ref,*ior_lookup_table) != 0)
- ACE_ERROR_RETURN ((LM_ERROR,
- "Unable to add IOR to the Table\n"),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to add IOR to the Table\n"),
+ -1);
arg_shifter.consume_arg ();
}
}
else if (ACE_OS::strcmp (current_arg, "-ORBDefaultInitRef") == 0)
- {
- arg_shifter.consume_arg ();
+ {
+ arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
default_init_ref = arg_shifter.get_current ();
arg_shifter.consume_arg ();
}
- }
+ }
else
arg_shifter.ignore_arg ();
}
@@ -999,7 +999,8 @@ int
TAO_ORB_Core::unset_leader_wake_up_follower (void)
// sets the leader_available flag to false and tries to wake up a follower
{
- ACE_Guard <ACE_SYNCH_MUTEX> g (this->leader_follower_lock ());
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon,
+ this->leader_follower_lock (), -1);
this->unset_leader_thread ();
diff --git a/TAO/tao/Wait_Strategy.cpp b/TAO/tao/Wait_Strategy.cpp
index 80325d120a7..93b34738f1d 100644
--- a/TAO/tao/Wait_Strategy.cpp
+++ b/TAO/tao/Wait_Strategy.cpp
@@ -233,11 +233,8 @@ TAO_Wait_On_Leader_Follower::wait (void)
// Now somebody woke us up to become a leader or to handle
// our input. We are already removed from the follower queue.
- if (this->reply_received_)
+ if (this->reply_received_ == 1)
{
- // We have received our reply, it is time to return control
- // to the application....
-
// But first reset our state in case we are invoked again...
this->reply_received_ = 0;
this->expecting_response_ = 0;
@@ -245,6 +242,21 @@ TAO_Wait_On_Leader_Follower::wait (void)
return 0;
}
+ else if (this->reply_received_ == -1)
+ {
+ // But first reset our state in case we are invoked again...
+ this->reply_received_ = 0;
+ this->expecting_response_ = 0;
+ this->calling_thread_ = ACE_OS::NULL_thread;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - L-F reply error\n"));
+
+ return -1;
+ }
+ // FALLTHROUGH
+ // We only get here if we woke up but the reply is not complete
+ // yet, time to assume the leader role....
}
// = Leader Code.
@@ -295,7 +307,11 @@ TAO_Wait_On_Leader_Follower::wait (void)
// Return an error if there was a problem receiving the reply...
result = 0;
if (this->reply_received_ == -1)
- result = -1;
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - L-F reply error\n"));
+ result = -1;
+ }
// Make us reusable
this->reply_received_ = 0;
@@ -326,25 +342,30 @@ TAO_Wait_On_Leader_Follower::handle_input (void)
// Receive any data that is available, without blocking...
int result = this->transport_->handle_client_input (0);
- // Severe error, abort....
- if (result == -1)
- {
- this->reply_received_ = -1;
- return -1;
- }
-
-
// Data was read, but there the reply has not been completely
// received...
if (result == 0)
return 0;
- // All the data is here!
- this->reply_received_ = 1;
+ // Severe error, abort....
+ if (result == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - L-F error while waiting on %d\n",
+ this->transport_->handle ()));
+
+ this->reply_received_ = -1;
+ }
+ else
+ {
+ // All the data is here!
+ this->reply_received_ = 1;
+ result = 0;
+ }
if (ACE_OS::thr_equal (this->calling_thread_, ACE_Thread::self ()))
{
- // We are the leader thread, simply return 1 to terminate the
+ // We are the leader thread, simply return 0 to terminate the
// event loop....
return 0;
}
@@ -365,10 +386,10 @@ TAO_Wait_On_Leader_Follower::handle_input (void)
if (cond == 0 || cond->signal () == -1)
{
// Yikes, what do we do here????
- return 0;
+ return result;
}
- return 0;
+ return result;
}
// Register the handler.
diff --git a/TAO/tests/MT_Client/test_i.cpp b/TAO/tests/MT_Client/test_i.cpp
index 2cbba3bbdaf..a71e2e849d5 100644
--- a/TAO/tests/MT_Client/test_i.cpp
+++ b/TAO/tests/MT_Client/test_i.cpp
@@ -1,6 +1,7 @@
// $Id$
#include "test_i.h"
+#include "tao/debug.h"
#if !defined(__ACE_INLINE__)
#include "test_i.i"
@@ -11,15 +12,17 @@ ACE_RCSID(MT_Client, test_i, "$Id$")
void
Simple_Server_i::test_method (CORBA::Environment&)
{
- ACE_DEBUG ((LM_DEBUG,
- "%N:%l:(%P:%t):Simple_Server_i::test_method called\n"));
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "%N:%l:(%P:%t):Simple_Server_i::test_method called\n"));
}
CORBA::Long
Simple_Server_i::get_number (CORBA::Environment&)
{
- ACE_DEBUG ((LM_DEBUG,
- "%N:%l:(%P:%t):Simple_Server_i::get_number called\n"));
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "%N:%l:(%P:%t):Simple_Server_i::get_number called\n"));
return (CORBA::ULong) 931232;
}