本文整理汇总了C++中CAddress::ToIPv4方法的典型用法代码示例。如果您正苦于以下问题:C++ CAddress::ToIPv4方法的具体用法?C++ CAddress::ToIPv4怎么用?C++ CAddress::ToIPv4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAddress
的用法示例。
在下文中一共展示了CAddress::ToIPv4方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckPeer
bool CPeerWatch::CheckPeer(const CAddress& Address, uint16 uPort, bool bIncoming)
{
int iEnable = theCore->Cfg()->GetInt("PeerWatch/Enable");
if(iEnable == 0)
return true;
uint64 uNow = GetCurTick();
// test banned cleints
map<CAddress, uint64>::iterator J = m_BanList.find(Address);
if(J != m_BanList.end())
{
if(J->second > uNow)
return false;
//m_BanList.erase(J);
}
if(iEnable == 2)
{
uint32 uAddress = Address.ToIPv4();
// check filtered IP's
if(!m_FilterList.empty())
{
SIPFilter* ppFound = (SIPFilter*)bsearch(&uAddress, &m_FilterList[0], m_FilterList.size(), sizeof(SIPFilter), CmpSIPFilterByAddr);
if (ppFound /*&& ppFound->uLevel < level*/)
return false;
}
}
// test dead sources
if(bIncoming)
return true;
map<SPeer, uint64>::iterator I = m_DeadList.find(SPeer(Address, uPort));
if(I != m_DeadList.end())
{
if(I->second > uNow)
return false;
//m_DeadList.erase(I);
}
return true;
}