当前位置: 首页>>代码示例>>C++>>正文


C++ reactor函数代码示例

本文整理汇总了C++中reactor函数的典型用法代码示例。如果您正苦于以下问题:C++ reactor函数的具体用法?C++ reactor怎么用?C++ reactor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reactor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: conf

bool CoAPRDService::initialize()
{
    try
    {
        std::string conf("service.conf");
        std::string reactor("service.reactor");

        _confPtr = ServiceGetter::findByName<ConfService>(context(), conf);
        _reactorPtr = ServiceGetter::findByName<ReactorService>(context(), reactor);

    }
    catch(toolkit::NullPointerException &e)
    {
        ACE_DEBUG((LM_DEBUG, "get service failed at SerialPortService\n"));

        return false;
    }


    _coapWrapperPtr = new CoAPWrapper();

    if (_coapWrapperPtr->Create(_confPtr->_rdAddr,
                                _confPtr->_rdAddrPort,
                                _confPtr->_coapDebugLevel
                               ) < 0)
    {

        ACE_DEBUG((LM_DEBUG,"Failed to create coap\n"));
        return false;
    }

    _rdRes = new CoAP_RD_Resource(_coapWrapperPtr.get());

    if ((_rdRes->Create()) == 0)
    {
        ACE_DEBUG((LM_DEBUG,"Failed to craete rd resource\n"));
        return false;
    }

    _rdLookup = new CoAPRDLookUpResource(_coapWrapperPtr.get());

    if ((_rdLookup->Create()) == 0)
    {
        ACE_DEBUG((LM_DEBUG,"Failed to craete lookup resource\n"));
        return false;
    }

    ACE_Time_Value timeout;
    timeout.sec(5);

    _reactorPtr->register_handler(this, ACE_Event_Handler::READ_MASK);
    _reactorPtr->schedule_timer(this, 0, timeout);


    return true;
}
开发者ID:hisilicon,项目名称:IoTGateway,代码行数:56,代码来源:CoAPRdService.cpp

示例2: Quit_Handler

 Quit_Handler (ACE_Reactor *r) : ACE_Event_Handler (r) {
   SetConsoleMode (ACE_STDIN, ENABLE_LINE_INPUT
                              | ENABLE_ECHO_INPUT
                              | ENABLE_PROCESSED_INPUT);
   if (reactor ()->register_handler
         (this, quit_seen_.handle ()) == -1
       || ACE_Event_Handler::register_stdin_handler
            (this, r, ACE_Thread_Manager::instance ()) == -1)
     r->end_reactor_event_loop ();
 }
开发者ID:asdlei00,项目名称:ACE,代码行数:10,代码来源:WFMO_Reactor_Logging_Server.cpp

示例3: ACE_UNUSED_ARG

int TCPConnectionHandler::handle_output (ACE_HANDLE handle)
{
  ACE_UNUSED_ARG (handle);
  if (!buffers_)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("TCPConnectionHandler::handle_output call for empty buffers (%d)\n"), handle));
  if (0 > sendBuffers ()) // socket broken, kill yourself
    return -1;

  if (!buffers_) // everything already send, unregister
    {
      reactor ()->cancel_wakeup (this,
                                 ACE_Event_Handler::WRITE_MASK | ACE_Event_Handler::DONT_CALL);
      reactor ()->remove_handler (this,
                                  ACE_Event_Handler::WRITE_MASK  | ACE_Event_Handler::DONT_CALL);
    }

  return 0;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:19,代码来源:QtReactor_Test.cpp

示例4: logError

bool
OpenDDS::DCPS::ReliableMulticast::detail::ReactivePacketSender::open(
  )
{
  if (socket_.ACE_SOCK_Dgram::open(
    local_address_
    ) == -1)
  {
    logError("ReactivePacketSender: failure to open\n");
    return false;
  }


  ACE_INET_Addr address;
  if (this->socket_.get_local_addr (address) != 0)
  {
    ACE_ERROR_RETURN ((LM_ERROR,
      ACE_TEXT ("(%P|%t) ERROR: ReliableMulticast::open_socket ")
      ACE_TEXT ("- %p"),
      ACE_TEXT ("cannot get local addr\n")),
      false);
  }
  this->local_address_.set_port_number (address.get_port_number ());

  if (reactor()->register_handler(
    this,
    ACE_Event_Handler::READ_MASK
    ) == -1)
  {
    logError("ReactivePacketSender: failure to register_handler\n");
    return false;
  }
  if (reactor()->schedule_timer(
    this,
    0,
    ACE_Time_Value(1),
    ACE_Time_Value(1)
    ) == -1)
  {
    logError("ReactivePacketSender: failure to schedule_timer\n");
  }
  return true;
}
开发者ID:svn2github,项目名称:OpenDDS,代码行数:43,代码来源:ReactivePacketSender.cpp

示例5: ACE_Message_Block

int AC_Input_Handler::close (u_long) {
  ACE_Message_Block *shutdown_message = 0;
  ACE_NEW_RETURN
    (shutdown_message,
     ACE_Message_Block (0, ACE_Message_Block::MB_STOP), -1);
  output_handler_->put (shutdown_message);

  reactor ()->remove_handler
    (connected_clients_, ACE_Event_Handler::READ_MASK);
  return output_handler_->wait ();
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:11,代码来源:AC_Client_Logging_Daemon.cpp

示例6: reactor

int KSG_Service_Handler::release()
{
	if(curr_blk_)
	{
		// 当接收数据一半的时候关闭连接,则需要释放资源
		curr_blk_->release();
		curr_blk_ = NULL;
	}
	reactor()->cancel_timer(this);
	//reactor()->remove_handler(this,ACE_Event_Handler::ALL_EVENTS_MASK);
	return 0;
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:12,代码来源:reactor_def.cpp

示例7: ACE_UNUSED_ARG

int
Stop_Handler::handle_input (ACE_HANDLE handle)
{
  ACE_UNUSED_ARG (handle);

  ACE_DEBUG ((LM_INFO,
              ACE_TEXT ("(%P|%t) Stop_Handler::handle_input - entered\n")));

  for (size_t i = 0; i < HANDLERS_TO_STOP_TABLE_SIZE; ++i)
    {
      // remove from the reactor's tables all non-null entries
      if (this->handlers_to_stop_[i])
        {
#if defined ACE_HAS_EXCEPTIONS

          // protect from deleted pointer
          try
            {
#endif // ACE_HAS_EXCEPTIONS

              this->reactor ()->cancel_timer (this->handlers_to_stop_[i]);
              this->reactor ()->remove_handler
                (this->handlers_to_stop_[i],
                 ACE_Event_Handler::ALL_EVENTS_MASK
                 | ACE_Event_Handler::DONT_CALL);
#if defined ACE_HAS_EXCEPTIONS
            }
          catch (...)
            {
              ACE_ERROR ((LM_ERROR,
                          ACE_TEXT ("(%P|%t) Stop_Handler::handle_input - ")
                          ACE_TEXT ("EXCEPTION CATCHED. Most probably ")
                          ACE_TEXT ("handler's pointer has been deleted.\n")));
            }
#endif // ACE_HAS_EXCEPTIONS
          this->handlers_to_stop_[i] = 0;
        }
    }

  this->reactor ()->remove_handler (this->registered_signals_);

  if (reactor ()->end_reactor_event_loop () == -1)
    {
      ACE_ERROR_RETURN ((LM_DEBUG,
                         ACE_TEXT ("(%P|%t) Stop_Handler::handle_signal:%p\n"),
                         ACE_TEXT ("end_reactor_event_loop")),
                        -1);
    }

  ACE_DEBUG ((LM_INFO,
              ACE_TEXT ("(%P|%t) Stop_Handler::handle_input - completed.\n")));
  return 0;
}
开发者ID:PGSeungminLee,项目名称:CGSF,代码行数:53,代码来源:Network_Adapters_Test.cpp

示例8: reactor

void P2pEndpoint::close()
{
    const ACE_Reactor_Mask masks = ACE_Event_Handler::ALL_EVENTS_MASK |
        ACE_Event_Handler::DONT_CALL;
    reactor()->remove_handler(this, masks);

    clearAddresses();

    if (isOpened()) {
        udp_->close();
        NSRPC_LOG_DEBUG(ACE_TEXT("UDP socket closed"));
    }
}
开发者ID:jcloudpld,项目名称:srpc,代码行数:13,代码来源:P2pEndpoint.cpp

示例9: TCPConnectionHandler

int TCPAcceptorHandler::make_svc_handler (TCPConnectionHandler *& sh)
{
  sh = new TCPConnectionHandler (true);
  sh->reactor (reactor ());
  if (handlersRegister_->TCPServersNo () >= HandlersNo)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("TCPAcceptorHandler::make_svc_handler called to many times!\n")));
  else
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("TCPAcceptorHandler::make_svc_handler new TCP server created\n")));

  return 0;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:13,代码来源:QtReactor_Test.cpp

示例10: reschedule

int Logging_Event_Handler_Ex::open () {
  int result = PARENT::open ();
  if (result != -1) {
    ACE_Time_Value reschedule (max_client_timeout_.sec () / 4);
    result =
      reactor ()->schedule_timer
        (this,
         0,
         max_client_timeout_,  // Initial timeout.
         reschedule);          // Subsequent timeouts.
  }
  return result;
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:13,代码来源:Logging_Event_Handler_Ex.cpp

示例11: schedp_

  ReactorTask::ReactorTask(ACE_Sched_Params *pschedp,
                           bool shutdownOnException,
                           int size) :
      schedp_(ACE_SCHED_OTHER, 0),
      reactor_(),
      shutdownOnException_(shutdownOnException)
  {
    MIRO_LOG_CTOR("Miro::ReactorTask");

    reactor(&reactor_);
    reactor_.open(size);
    if (pschedp)
      schedp_ = (*pschedp);
  }
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:14,代码来源:ReactorTask.cpp

示例12: get_peer

ACE_INT32 Handle_data::open( )
{	
	ACE_INT32 ret = 0;
	ACE_INET_Addr remote_addr;	
	get_peer().get_remote_addr( remote_addr );		
	ACE_DEBUG( (LM_DEBUG, "the remote addr is %s\n", remote_addr.get_host_addr())  );
	
	ret = reactor()->register_handler( this, ACE_Event_Handler::READ_MASK );
	if (ret != -1)	
	{		
		ACE_DEBUG( (LM_DEBUG, "handle data register ok!\n")  );		
	}	
	return ret;
}
开发者ID:BianJian,项目名称:steppingstone,代码行数:14,代码来源:handle_data.cpp

示例13: ACE_NEW_RETURN

int Logging_Acceptor::handle_input(ACE_HANDLE)
{
    Logging_Event_Handler *peer_handler = 0;
    ACE_NEW_RETURN(peer_handler, Logging_Event_Handler(reactor()), -1);
    if (acceptor_.accept(peer_handler->peer()) == -1) {
        delete peer_handler;
        return -1;
    } else if (peer_handler->open() == -1) {
        peer_handler->handle_close();
        return -1;
    }

    return 0;
}
开发者ID:chenjianlong,项目名称:books-code,代码行数:14,代码来源:logging_acceptor.cpp

示例14: ACE_DEBUG

int KSG_Service_Handler::handle_timeout(const ACE_Time_Value &current_time, const void *act )
{
	if(current_time - this->request_time_ >= max_client_timeout_
		|| current_time - this->connect_time_ >= max_client_timeout_)
	{
		ACE_DEBUG((LM_INFO,"连接超时,关闭连接..."));
		
		reactor()->remove_handler(this,ACE_Event_Handler::ALL_EVENTS_MASK|ACE_Event_Handler::DONT_CALL);
		//reactor()->notify(this);
		closed_ = 1;
		return -1;
	}
	return 0;
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:14,代码来源:reactor_def.cpp

示例15: reactor

int Ogre_TCPAccept_Hdl::handle_close ()
{
    //
    if (peer_acceptor_.get_handle () != ZCE_INVALID_SOCKET)
    {
        reactor()->remove_handler (this, true);
        peer_acceptor_.close ();
    }

    //删除自己
    delete this;

    return 0;
}
开发者ID:chenbk85,项目名称:zcelib,代码行数:14,代码来源:ogre_accept_handler.cpp


注:本文中的reactor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。