htbp_notifier.cpp

来自「ace开发环境 用来开发网络程序 其运用了设计模式、多平台、C++等多种知识」· C++ 代码 · 共 93 行

CPP
93
字号
/* -*- C++ -*- *///=============================================================================/** *  @file    HTBP_Notifier.cpp * *  $Id: HTBP_Notifier.cpp 79343 2007-08-14 21:49:55Z mesnier_p $ * *  @author Phil Mesnier, Priyanka Gontla *///=============================================================================#include "HTBP_Notifier.h"#include "HTBP_Channel.h"#include "HTBP_Session.h"#include "ace/Reactor.h"ACE_BEGIN_VERSIONED_NAMESPACE_DECLACE::HTBP::Notifier::Notifier (ACE::HTBP::Channel *s)  : channel_(s){}intACE::HTBP::Notifier::handle_input(ACE_HANDLE ){  switch (this->channel_->state())    {    case ACE::HTBP::Channel::Detached:      this->channel_->pre_recv();      break;    case ACE::HTBP::Channel::Wait_For_Ack:      this->channel_->recv_ack();      break;    default:      this->channel_->load_buffer();    }  if (this->channel_->state() == ACE::HTBP::Channel::Closed)    {      this->unregister();      return 0;    }  if (this->channel_->session_)    {      if (this->channel_ == this->channel_->session_->inbound())        {          ACE_Event_Handler *h = this->channel_->session_->handler();          if (h && this->reactor())            this->reactor()->notify(h,                                    ACE_Event_Handler::READ_MASK);          else            ACE_ERROR ((LM_ERROR,                        ACE_TEXT ("(%P|%t) ACE::HTBP::Notifier::handle_input ")                        ACE_TEXT ("Notifier cannot notify, session has no ")                        ACE_TEXT ("handler (%x), or reactor (%x)\n"),                        h,this->reactor()));        }      else        this->channel_->flush_buffer();    }  else    ACE_ERROR ((LM_ERROR,                ACE_TEXT ("(%P|%t) ACE::HTBP::Notifier::handle_input ")                ACE_TEXT ("Notifier has no session to notify!\n")));  return 0;}intACE::HTBP::Notifier::handle_output (ACE_HANDLE ){  return -1;}voidACE::HTBP::Notifier::unregister (void){  if (this->reactor())    this->reactor()->remove_handler(this,                                    ACE_Event_Handler::READ_MASK |                                    ACE_Event_Handler::DONT_CALL);}ACE_HANDLEACE::HTBP::Notifier::get_handle(void) const{  return this->channel_->ace_stream().get_handle();}ACE_END_VERSIONED_NAMESPACE_DECL

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?