本文整理汇总了C++中NetConnection::getNetAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ NetConnection::getNetAddress方法的具体用法?C++ NetConnection::getNetAddress怎么用?C++ NetConnection::getNetAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetConnection
的用法示例。
在下文中一共展示了NetConnection::getNetAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HashNetAddress
NetConnection *NetConnection::lookup(const NetAddress *addr)
{
U32 hashIndex = HashNetAddress(addr);
for(NetConnection *walk = mHashTable[hashIndex]; walk; walk = walk->mNextTableHash)
if(Net::compareAddresses(addr, walk->getNetAddress()))
return walk;
return NULL;
}
示例2: removeConnection
void NetInterface::removeConnection(NetConnection *conn)
{
for(S32 i = 0; i < mConnectionList.size(); i++)
{
if(mConnectionList[i] == conn)
{
mConnectionList.erase_fast(i);
break;
}
}
U32 index = conn->getNetAddress().hash() % mConnectionHashTable.size();
U32 startIndex = index;
while(mConnectionHashTable[index] != conn)
{
index++;
if(index >= (U32) mConnectionHashTable.size())
index = 0;
TNLAssert(index != startIndex, "Attempting to remove a connection that is not in the table.") // not in the table
if(index == startIndex)
return;
}
mConnectionHashTable[index] = NULL;
// rehash all subsequent entries until we find a NULL entry:
for(;;)
{
index++;
if(index >= (U32) mConnectionHashTable.size())
index = 0;
if(!mConnectionHashTable[index])
break;
NetConnection *rehashConn = mConnectionHashTable[index];
mConnectionHashTable[index] = NULL;
U32 realIndex = rehashConn->getNetAddress().hash() % mConnectionHashTable.size();
while(mConnectionHashTable[realIndex] != NULL)
{
realIndex++;
if(realIndex >= (U32) mConnectionHashTable.size())
realIndex = 0;
}
mConnectionHashTable[realIndex] = rehashConn;
}
conn->decRef();
}