summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-24 21:32:17 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-24 21:32:17 +0000
commit8605db1dc9c3b0236e8ebf2a25c9ca322f5ba1c7 (patch)
tree0f939a138ed24d6a7061ef6e7d236d6e15c9c7db
parenta925ccfffb4ef6ccc2ee7fada396a12a8df83c81 (diff)
downloadATCD-8605db1dc9c3b0236e8ebf2a25c9ca322f5ba1c7.tar.gz
Moving towards having a single Connection Handler. Abstracted out
their code to the Wait_Strategies. Right now, the ST and RW connection handlers are gone.
-rw-r--r--TAO/tao/Wait_Strategy.cpp93
1 files changed, 83 insertions, 10 deletions
diff --git a/TAO/tao/Wait_Strategy.cpp b/TAO/tao/Wait_Strategy.cpp
index b3a37c87cbb..453c4101a2b 100644
--- a/TAO/tao/Wait_Strategy.cpp
+++ b/TAO/tao/Wait_Strategy.cpp
@@ -31,21 +31,12 @@ TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor (void)
int
TAO_Wait_On_Reactor::wait (void)
{
- // Result of the Reactor event loop.
int result = 0;
- // Flag that tells when we have finished reading the whole of the
- // incoming message.
- // int end_loop_flag = 0;
-
- while (result == 0) // != -1 && end_loop_flag == 0)
+ while (result == 0)
{
// Do the event loop.
result = this->transport_->orb_core ()->reactor ()->handle_events (/* timeout */);
-
- // Check for ending the event loop.
- // if (this->transport_->message_size () == this->transport_->message_offset ())
- // end_loop_flag = 1;
}
if (result == -1)
@@ -54,6 +45,45 @@ TAO_Wait_On_Reactor::wait (void)
return 0;
}
+int
+TAO_Wait_On_Reactor::handle_input (void)
+{
+ int result = 0;
+
+ // Temporarily remove ourself from notification so that if
+ // another sub event loop is in effect still waiting for its
+ // response, it doesn't spin tightly gobbling up CPU.
+ result = this->transport_->suspend_handler ();
+
+ // Ask the Transport object to read the input without blocking.
+ result = this->transport_->handle_client_input (0);
+
+ // If message is not read fully, resume the handler.
+ if (result == 0)
+ result = this->transport_->resume_handler ();
+
+ if (result != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO: %N:%l:TAO_Wait_On_Reactor::handle_input:%p\n",
+ "resume_handler failed"),
+ -1);
+
+ return 0;
+}
+
+// Register the handler with the Reactor.
+int
+TAO_Wait_On_Reactor::register_handler (TAO_IIOP_Handler_Base *handler)
+{
+ return this->transport_->register_handler ();
+}
+
+int
+TAO_Wait_On_Reactor::resume_handler (ACE_Reactor *reactor)
+{
+ return this->transport_->resume_handler ();
+}
+
// *********************************************************************
// Constructor.
@@ -117,6 +147,28 @@ TAO_Wait_On_Leader_Follower::wait (void)
return 0;
}
+// Handle the input. Delegate this job to Transport object. Before
+// that, suspend the handler in the Reactor.
+int
+TAO_Wait_On_Leader_Follower::handle_input (void)
+{
+ return -1;
+}
+
+// Register the handler.
+int
+TAO_Wait_On_Leader_Follower::register_handler (TAO_IIOP_Handler_Base *)
+{
+ return 0;
+}
+
+// Resume the connection handler.
+int
+TAO_Wait_On_Leader_Follower::resume_handler (ACE_Reactor *reactor)
+{
+ return -1;
+}
+
// *********************************************************************
// Constructor.
@@ -146,3 +198,24 @@ TAO_Wait_On_Read::wait (void)
return 0;
}
+
+// Handle the input. Delegate this job to Transport object.
+// Resume the connection handler. No-op. Returns 0.
+int
+TAO_Wait_On_Read::handle_input (void)
+{
+ return -1;
+}
+
+// No-op.
+int
+TAO_Wait_On_Read::register_handler (TAO_IIOP_Handler_Base *)
+{
+ return 0;
+}
+
+int
+TAO_Wait_On_Read::resume_handler (ACE_Reactor *reactor)
+{
+ return -1;
+}