• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ace_asynch_connect::Result类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: g

int
Connector::validate_connection(const ACE_Asynch_Connect::Result&  result,
                               const ACE_INET_Addr& /*remote*/,
                               const ACE_INET_Addr& /*local*/)
{
  ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, monitor, this->mutex (), -1);

  --this->ref_cnt_;

  int rc = 0;
  if (!result.success() || this->should_finish())
    {
      rc = -1;

      ACE_Errno_Guard g (errno);
      errno = result.error();
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("(%t) Connector: %p\n"),
                  ACE_TEXT ("connect failed")));
    }

  if(this->is_safe_to_delete())
    this->task().signal_main();

  return rc;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:26,代码来源:PSession.cpp


示例2: defined

template <class HANDLER> void
ACE_Asynch_Connector<HANDLER>::parse_address (const ACE_Asynch_Connect::Result &result,
                                              ACE_INET_Addr &remote_address,
                                              ACE_INET_Addr &local_address)
{
#if defined (ACE_HAS_IPV6)
  // Getting the addresses.
  sockaddr_in6 local_addr;
  sockaddr_in6 remote_addr;
#else
  // Getting the addresses.
  sockaddr_in local_addr;
  sockaddr_in remote_addr;
#endif /* ACE_HAS_IPV6 */

  // Get the length.
  int local_size = sizeof (local_addr);
  int remote_size = sizeof (remote_addr);

  // Get the local address.
  if (ACE_OS::getsockname (result.connect_handle (),
                           reinterpret_cast<sockaddr *> (&local_addr),
                           &local_size) < 0)
    ACELIB_ERROR ((LM_ERROR,
                ACE_TEXT("%p\n"),
                ACE_TEXT("ACE_Asynch_Connector::<getsockname> failed")));

  // Get the remote address.
  if (ACE_OS::getpeername (result.connect_handle (),
                           reinterpret_cast<sockaddr *> (&remote_addr),
                           &remote_size) < 0)
    ACELIB_ERROR ((LM_ERROR,
                ACE_TEXT("%p\n"),
                ACE_TEXT("ACE_Asynch_Connector::<getpeername> failed")));

  // Set the addresses.
  local_address.set  (reinterpret_cast<sockaddr_in *> (&local_addr),
                      local_size);
  remote_address.set (reinterpret_cast<sockaddr_in *> (&remote_addr),
                      remote_size);

  return;
}
开发者ID:Adeer,项目名称:OregonCore,代码行数:43,代码来源:Asynch_Connector.cpp


示例3:

int
Connector::validate_connection (const ACE_Asynch_Connect::Result& result,
  const ACE_INET_Addr &remote, const ACE_INET_Addr& local)
{
  ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, this->mtx_, -1);

  ACE_UNUSED_ARG (result);
  ACE_UNUSED_ARG (remote);
  ACE_UNUSED_ARG (local);

  if (!result.success ())
  {
    ACE_DEBUG ((LM_DEBUG, ACE_TEXT (
      "Connector::validate_connection failed: %d\n"), result.error ()));
    return -1;
  }
  else
  {
    return 0;
  }
}
开发者ID:CCJY,项目名称:ACE,代码行数:21,代码来源:Bug_2912_Regression_Test.cpp


示例4: validate_connection

int CProAsynchConnect::validate_connection(const ACE_Asynch_Connect::Result& result, const ACE_INET_Addr& remote, const ACE_INET_Addr& local)
{
    //异步检验链接是否有效,如果有效
    int nError   = result.error();
    int nRet     = result.success ();
    ACE_HANDLE h = result.connect_handle();

    if (!nRet || h == ACE_INVALID_HANDLE)
    {
        SetConnectState(false);

        _ProConnectState_Info* pProConnectStateInfo = static_cast<_ProConnectState_Info* >(const_cast<void*>(result.act()));

        if(NULL != pProConnectStateInfo)
        {
            m_nServerID = pProConnectStateInfo->m_nServerID;
            SAFE_DELETE(pProConnectStateInfo);
        }

        ACE_INET_Addr remoteaddr = App_ClientProConnectManager::instance()->GetServerAddr(m_nServerID);
        App_ClientProConnectManager::instance()->SetServerConnectState(m_nServerID, SERVER_CONNECT_FAIL);
        OUR_DEBUG((LM_ERROR, "[CProAsynchConnect::validate_connection](%s:%d) connection fails,error=%d(ServerID=%d).\n", remoteaddr.get_host_addr(), remoteaddr.get_port_number(), nError, m_nServerID));
        m_nServerID = 0;

        return 1;
    }

    _ProConnectState_Info* pProConnectStateInfo = static_cast<_ProConnectState_Info* >(const_cast<void*>(result.act()));

    if(NULL != pProConnectStateInfo)
    {
        m_nServerID = pProConnectStateInfo->m_nServerID;
        SAFE_DELETE(pProConnectStateInfo);
    }


    //OUR_DEBUG((LM_ERROR, "[CProAsynchConnect::validate_connection]Connect IP=%s,Port=%d OK.\n", remote.get_host_addr(), remote.get_port_number()));
    return 0;
}
开发者ID:freeeyes,项目名称:PSS,代码行数:39,代码来源:ProAsynchConnect.cpp


示例5: sizeof

int
RPG_Net_Client_AsynchConnector::validate_connection(const ACE_Asynch_Connect::Result& result_in,
        const ACE_INET_Addr& remoteSAP_in,
        const ACE_INET_Addr& localSAP_in)
{
    RPG_TRACE(ACE_TEXT("RPG_Net_Client_AsynchConnector::validate_connection"));

    // success ?
    if (result_in.success() == 0)
    {
        // debug info
        ACE_TCHAR buffer[RPG_COMMON_BUFSIZE];
        ACE_OS::memset(buffer, 0, sizeof(buffer));
        if (remoteSAP_in.addr_to_string(buffer, sizeof(buffer)) == -1)
            ACE_DEBUG((LM_ERROR,
                       ACE_TEXT("failed to ACE_INET_Addr::addr_to_string(): \"%m\", continuing\n")));
        ACE_DEBUG((LM_ERROR,
                   ACE_TEXT("failed to RPG_Net_Client_AsynchConnector::connect(\"%s\"): \"%s\", aborting\n"),
                   buffer,
                   ACE_OS::strerror(result_in.error())));
    } // end IF

    return ((result_in.success() == 1) ? 0 : -1);
}
开发者ID:bhutnath,项目名称:yarp,代码行数:24,代码来源:rpg_net_client_asynchconnector.cpp


示例6: g

int
Connector::validate_connection(const ACE_Asynch_Connect::Result&  result,
                               const ACE_INET_Addr& /*remote*/,
                               const ACE_INET_Addr& /*local*/)
{
    int rc = 0;
    if (!result.success())
    {

        ACE_Errno_Guard g (errno);

        ACE_Log_Msg::instance ()->errnum (result.error ());
        ACE_OS::last_error (result.error ());

        ACE_DEBUG ((LM_DEBUG,
                    ACE_TEXT ("(%t) Connector: error=%d %p\n"),
                    (int) result.error(),
                    ACE_TEXT ("connect failed")));

        rc = -1;

    }
    return rc;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:24,代码来源:PConnection.cpp


示例7:

template <class HANDLER> void
ACE_Asynch_Connector<HANDLER>::handle_connect (const ACE_Asynch_Connect::Result &result)
{
  // Variable for error tracking
  int error = 0;

  // If the asynchronous connect fails.
  if (!result.success () ||
      result.connect_handle () == ACE_INVALID_HANDLE)
    {
      error = 1;
    }

  if (result.error () != 0)
    {
      error = 1;
    }

  // set blocking mode
  if (!error &&
      ACE::clr_flags
        (result.connect_handle (), ACE_NONBLOCK) != 0)
    {
      error = 1;
      ACELIB_ERROR ((LM_ERROR,
                  ACE_TEXT ("%p\n"),
                  ACE_TEXT ("ACE_Asynch_Connector::handle_connect : Set blocking mode")));
    }

  // Parse the addresses.
  ACE_INET_Addr local_address;
  ACE_INET_Addr remote_address;
  if (!error &&
      (this->validate_new_connection_ || this->pass_addresses_))
    this->parse_address (result,
                         remote_address,
                         local_address);

  // Call validate_connection even if there was an error - it's the only
  // way the application can learn the connect disposition.
  if (this->validate_new_connection_ &&
      this->validate_connection (result, remote_address, local_address) == -1)
    {
      error = 1;
    }

  HANDLER *new_handler = 0;
  if (!error)
    {
      // The Template method
      new_handler = this->make_handler ();
      if (new_handler == 0)
        {
          error = 1;
          ACELIB_ERROR ((LM_ERROR,
                      ACE_TEXT ("%p\n"),
                      ACE_TEXT ("ACE_Asynch_Connector::handle_connect : Making of new handler failed")));
        }
    }

  // If no errors
  if (!error)
    {
      // Update the Proactor.
      new_handler->proactor (this->proactor ());

      // Pass the addresses
      if (this->pass_addresses_)
        new_handler->addresses (remote_address,
                                local_address);

      // Pass the ACT
      if (result.act () != 0)
        new_handler->act (result.act ());

      // Set up the handler's new handle value
      new_handler->handle (result.connect_handle ());

      ACE_Message_Block  mb;

      // Initiate the handler with empty message block;
      new_handler->open (result.connect_handle (), mb);
    }

  // On failure, no choice but to close the socket
  if (error &&
      result.connect_handle() != ACE_INVALID_HANDLE)
    ACE_OS::closesocket (result.connect_handle ());
}
开发者ID:Adeer,项目名称:OregonCore,代码行数:89,代码来源:Asynch_Connector.cpp


示例8: defined

template <class HANDLER> void
ACE_Asynch_Connector<HANDLER>::parse_address (const ACE_Asynch_Connect::Result &result,
                                              ACE_INET_Addr &remote_address,
                                              ACE_INET_Addr &local_address)
{
#if defined (ACE_HAS_IPV6)
  // Getting the addresses.
  sockaddr_in6 local_addr;
  sockaddr_in6 remote_addr;
#else
  // Getting the addresses.
  sockaddr_in local_addr;
  sockaddr_in remote_addr;
#endif /* ACE_HAS_IPV6 */

  // Get the length.
  int local_size = sizeof (local_addr);
  int remote_size = sizeof (remote_addr);

  // Get the local address.
  if (ACE_OS::getsockname (result.connect_handle (),
                           reinterpret_cast<sockaddr *> (&local_addr),
                           &local_size) < 0)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT("%p\n"),
                ACE_TEXT("ACE_Asynch_Connector::<getsockname> failed")));

  // Get the remote address.
  if (ACE_OS::getpeername (result.connect_handle (),
                           reinterpret_cast<sockaddr *> (&remote_addr),
                           &remote_size) < 0)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT("%p\n"),
                ACE_TEXT("ACE_Asynch_Connector::<getpeername> failed")));

  // Set the addresses.
  local_address.set  (reinterpret_cast<sockaddr_in *> (&local_addr),
                      local_size);
  remote_address.set (reinterpret_cast<sockaddr_in *> (&remote_addr),
                      remote_size);

#if 0
  // @@ Just debugging.
  char local_address_buf  [BUFSIZ];
  char remote_address_buf [BUFSIZ];

  if (local_address.addr_to_string (local_address_buf,
                                    sizeof local_address_buf) == -1)
    ACE_ERROR ((LM_ERROR,
                "Error:%m:can't obtain local_address's address string"));

  ACE_DEBUG ((LM_DEBUG,
              "ACE_Asynch_Connector<HANDLER>::parse_address : "
              "Local address %s\n",
              local_address_buf));

  if (remote_address.addr_to_string (remote_address_buf,
                                     sizeof remote_address_buf) == -1)
    ACE_ERROR ((LM_ERROR,
                "Error:%m:can't obtain remote_address's address string"));

  ACE_DEBUG ((LM_DEBUG,
              "ACE_Asynch_Connector<HANDLER>::parse_address : "
              "Remote address %s\n",
              remote_address_buf));
#endif /* 0 */

  return;
}
开发者ID:yuanxu,项目名称:liveshow_r2,代码行数:69,代码来源:Asynch_Connector.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ace_asynch_read_stream::Result类代码示例发布时间:2022-05-31
下一篇:
C++ accountframe::pointer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap