本文整理汇总了C++中ace_asynch_connect::Result::error方法的典型用法代码示例。如果您正苦于以下问题:C++ Result::error方法的具体用法?C++ Result::error怎么用?C++ Result::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ace_asynch_connect::Result
的用法示例。
在下文中一共展示了Result::error方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例6:
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 ());
}