summaryrefslogtreecommitdiff
path: root/TAO/tao/Reactive_Flushing_Strategy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/Reactive_Flushing_Strategy.cpp')
-rw-r--r--TAO/tao/Reactive_Flushing_Strategy.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/TAO/tao/Reactive_Flushing_Strategy.cpp b/TAO/tao/Reactive_Flushing_Strategy.cpp
new file mode 100644
index 00000000000..58df0474633
--- /dev/null
+++ b/TAO/tao/Reactive_Flushing_Strategy.cpp
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+// $Id$
+
+#include "Reactive_Flushing_Strategy.h"
+#include "Transport.h"
+#include "ORB_Core.h"
+#include "Queued_Message.h"
+
+ACE_RCSID(tao, Reactive_Flushing_Strategy, "$Id$")
+
+int
+TAO_Reactive_Flushing_Strategy::schedule_output (TAO_Transport *transport)
+{
+ ACE_Reactor *reactor =
+ transport->orb_core ()->reactor ();
+
+ return reactor->register_handler (transport->event_handler (),
+ ACE_Event_Handler::READ_MASK
+ | ACE_Event_Handler::WRITE_MASK);
+}
+
+int
+TAO_Reactive_Flushing_Strategy::cancel_output (TAO_Transport *transport)
+{
+ ACE_Reactor *reactor =
+ transport->orb_core ()->reactor ();
+
+ return reactor->register_handler (transport->event_handler (),
+ ACE_Event_Handler::READ_MASK);
+}
+
+int
+TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport,
+ TAO_Queued_Message *msg)
+{
+ TAO_ORB_Core *orb_core = transport->orb_core ();
+
+ int result = 0;
+ // @@ Should we pass this down? Can we?
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ while (!msg->done () && result > 0)
+ {
+ result = orb_core->run (0, 1, ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCHANY
+ {
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return result;
+}