Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Oneway_Buffering / Oneway_Buffering_Admin.cpp
blob38e92acfb0ddd712044075e376cac18772379cad
1 #include "Oneway_Buffering_Admin.h"
2 #include "ace/OS_NS_unistd.h"
4 namespace
6 const unsigned int timeout_in_sec= 2u;
9 Oneway_Buffering_Admin::Oneway_Buffering_Admin (CORBA::ORB_ptr orb)
10 : orb_ (CORBA::ORB::_duplicate (orb))
11 , request_count_ (0)
12 , bytes_received_count_ (0)
16 CORBA::ULong
17 Oneway_Buffering_Admin::request_count (CORBA::ULong expected_request_count)
19 ACE_Time_Value timeout (timeout_in_sec);
20 while ( (this->request_count_ < expected_request_count)
21 && (ACE_Time_Value::zero < timeout) )
23 orb_->perform_work (timeout); // Do some work, decreases timeout for amount done.
25 return this->request_count_;
28 CORBA::ULong
29 Oneway_Buffering_Admin::bytes_received_count (CORBA::ULong expected_bytes_received_count)
31 ACE_Time_Value timeout (timeout_in_sec);
32 while ( (this->bytes_received_count_ < expected_bytes_received_count)
33 && (ACE_Time_Value::zero < timeout) )
35 orb_->perform_work (timeout); // Do some work, decreases timeout for amount done.
37 return this->bytes_received_count_;
40 void
41 Oneway_Buffering_Admin::request_received (CORBA::ULong payload_length)
43 this->request_count_++;
44 this->bytes_received_count_ += payload_length;
47 void
48 Oneway_Buffering_Admin::flush (void)
52 void
53 Oneway_Buffering_Admin::shutdown (void)
55 this->orb_->shutdown (0);