Reactive_Flushing_Strategy.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: Reactive_Flushing_Strategy.cpp 80620 2008-02-12 17:54:51Z johnc $
00003 
00004 #include "tao/Reactive_Flushing_Strategy.h"
00005 #include "tao/Transport.h"
00006 #include "tao/ORB_Core.h"
00007 #include "tao/Queued_Message.h"
00008 
00009 ACE_RCSID (tao,
00010            Reactive_Flushing_Strategy,
00011            "$Id: Reactive_Flushing_Strategy.cpp 80620 2008-02-12 17:54:51Z johnc $")
00012 
00013 
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 int
00017 TAO_Reactive_Flushing_Strategy::schedule_output (TAO_Transport *transport)
00018 {
00019   return transport->schedule_output_i ();
00020 }
00021 
00022 int
00023 TAO_Reactive_Flushing_Strategy::cancel_output (TAO_Transport *transport)
00024 {
00025   return transport->cancel_output_i ();
00026 }
00027 
00028 int
00029 TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport,
00030                                                TAO_Queued_Message *msg,
00031                                                ACE_Time_Value *max_wait_time)
00032 {
00033   int result = 0;
00034 
00035   // @@ Should we pass this down?  Can we?
00036   try
00037     {
00038       TAO_ORB_Core * const orb_core = transport->orb_core ();
00039 
00040       while (!msg->all_data_sent () && result >= 0)
00041         {
00042           result = orb_core->run (max_wait_time, 1);
00043 
00044           if (max_wait_time != 0) {
00045             if (*max_wait_time <= ACE_Time_Value::zero) {
00046               errno = ETIME;
00047               result = -1;
00048             }
00049           }
00050         }
00051     }
00052   catch (const ::CORBA::Exception&)
00053     {
00054       return -1;
00055     }
00056 
00057   return result;
00058 }
00059 
00060 int
00061 TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport
00062                                                  , ACE_Time_Value *max_wait_time)
00063 {
00064   try
00065     {
00066       TAO_ORB_Core * const orb_core = transport->orb_core ();
00067 
00068       while (!transport->queue_is_empty ())
00069         {
00070           if (orb_core->run (max_wait_time, 1) == -1)
00071             return -1;
00072 
00073           if (max_wait_time != 0) {
00074             if (*max_wait_time <= ACE_Time_Value::zero) {
00075               errno = ETIME;
00076               return -1;
00077             }
00078           }
00079         }
00080     }
00081   catch (const ::CORBA::Exception&)
00082     {
00083       return -1;
00084     }
00085 
00086   return 0;
00087 }
00088 
00089 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7