Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / protocols / ace / HTBP / HTBP_Notifier.cpp
blob8aaff832e57f02ccb8dfe0cc69f78e58cff88126
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file HTBP_Notifier.cpp
7 * @author Phil Mesnier, Priyanka Gontla
8 */
9 //=============================================================================
10 #include "HTBP_Notifier.h"
11 #include "HTBP_Channel.h"
12 #include "HTBP_Session.h"
13 #include "ace/Reactor.h"
15 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
17 ACE::HTBP::Notifier::Notifier (ACE::HTBP::Channel *s)
18 : channel_(s)
22 int
23 ACE::HTBP::Notifier::handle_input(ACE_HANDLE )
25 switch (this->channel_->state())
27 case ACE::HTBP::Channel::Detached:
28 this->channel_->pre_recv();
29 break;
30 case ACE::HTBP::Channel::Wait_For_Ack:
31 this->channel_->recv_ack();
32 break;
33 default:
34 this->channel_->load_buffer();
37 if (this->channel_->state() == ACE::HTBP::Channel::Closed)
39 this->unregister();
40 return 0;
43 if (this->channel_->session_)
45 if (this->channel_ == this->channel_->session_->inbound())
47 ACE_Event_Handler *h = this->channel_->session_->handler();
48 if (h && this->reactor())
49 this->reactor()->notify(h,
50 ACE_Event_Handler::READ_MASK);
51 else
52 ACE_ERROR ((LM_ERROR,
53 ACE_TEXT ("(%P|%t) ACE::HTBP::Notifier::handle_input ")
54 ACE_TEXT ("Notifier cannot notify, session has no ")
55 ACE_TEXT ("handler (%x), or reactor (%x)\n"),
56 h,this->reactor()));
58 else
59 this->channel_->flush_buffer();
61 else
62 ACE_ERROR ((LM_ERROR,
63 ACE_TEXT ("(%P|%t) ACE::HTBP::Notifier::handle_input ")
64 ACE_TEXT ("Notifier has no session to notify!\n")));
65 return 0;
68 int
69 ACE::HTBP::Notifier::handle_output (ACE_HANDLE )
71 return -1;
74 void
75 ACE::HTBP::Notifier::unregister ()
77 if (this->reactor())
78 this->reactor()->remove_handler(this,
79 ACE_Event_Handler::READ_MASK |
80 ACE_Event_Handler::DONT_CALL);
83 ACE_HANDLE
84 ACE::HTBP::Notifier::get_handle() const
86 return this->channel_->ace_stream().get_handle();
89 ACE_END_VERSIONED_NAMESPACE_DECL