mirror of
https://bitbucket.org/seefoe/src.git
synced 2026-07-31 01:15:45 -04:00
some more fixes to test
This commit is contained in:
-2
@@ -97,8 +97,6 @@ GenericAPICore::~GenericAPICore()
|
||||
delete (*iter).second;
|
||||
}
|
||||
|
||||
m_pending.empty();
|
||||
|
||||
while(m_outCount > 0)
|
||||
{
|
||||
delete m_outboundQueue.front().second;
|
||||
|
||||
@@ -2569,53 +2569,60 @@ void CentralServer::removeConnectionServerConnection(const ConnectionServerConne
|
||||
*/
|
||||
void CentralServer::removeGameServer(GameServerConnection const *gameServer)
|
||||
{
|
||||
uint32 const pid = gameServer->getProcessId();
|
||||
|
||||
LOG("ServerStartup", ("Game Server %lu went down", pid));
|
||||
|
||||
//@todo this whole function needs a re-write.
|
||||
NOT_NULL(gameServer);
|
||||
std::map<uint32, GameServerConnection *>::iterator const i = m_gameServerConnections.find(pid);
|
||||
if (i == m_gameServerConnections.end())
|
||||
return;
|
||||
|
||||
for (std::vector<GameServerConnection *>::iterator ii = m_gameServerConnectionsList.begin(); ii != m_gameServerConnectionsList.end();)
|
||||
if (gameServer != nullptr)
|
||||
{
|
||||
if ((*ii) == i->second)
|
||||
ii = m_gameServerConnectionsList.erase(ii);
|
||||
else
|
||||
++ii;
|
||||
uint32 const pid = gameServer->getProcessId();
|
||||
|
||||
LOG("ServerStartup", ("Game Server %lu went down", pid));
|
||||
|
||||
//@todo this whole function needs a re-write.
|
||||
NOT_NULL(gameServer);
|
||||
std::map<uint32, GameServerConnection *>::iterator const i = m_gameServerConnections.find(pid);
|
||||
if (i == m_gameServerConnections.end())
|
||||
return;
|
||||
|
||||
for (std::vector<GameServerConnection *>::iterator ii = m_gameServerConnectionsList.begin(); ii != m_gameServerConnectionsList.end();)
|
||||
{
|
||||
if ((*ii) == i->second)
|
||||
ii = m_gameServerConnectionsList.erase(ii);
|
||||
else
|
||||
++ii;
|
||||
}
|
||||
|
||||
m_gameServerConnections.erase(i);
|
||||
|
||||
/** @todo: this is slow, find a better way (probably by creating reverse
|
||||
* lookup table(s))
|
||||
*/
|
||||
if (pid == m_dbProcessServerProcessId)
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Database process died -- Central will exit and let the cluster restart\n"));
|
||||
m_done = true;
|
||||
return; //lint !e527 Unreachable
|
||||
}
|
||||
|
||||
DEBUG_WARNING(true, ("Game server %lu crashed", pid));
|
||||
|
||||
for (SceneGameMap::iterator j = m_gameServers.begin(); j != m_gameServers.end();)
|
||||
{
|
||||
if ((*j).second == gameServer)
|
||||
m_gameServers.erase(j++);
|
||||
else
|
||||
++j;
|
||||
}
|
||||
|
||||
UniverseManager::getInstance().onGameServerDisconnect(*gameServer);
|
||||
PlanetManager::onGameServerDisconnect(gameServer);
|
||||
CharacterCreationTracker::getInstance().onGameServerDisconnect(pid);
|
||||
ClusterWideDataManagerList::onGameServerDisconnect(pid);
|
||||
|
||||
ExcommunicateGameServerMessage const excommunicateMessage(pid, 0, "");
|
||||
sendToAllGameServersExceptDBProcess(excommunicateMessage, true);
|
||||
}
|
||||
|
||||
m_gameServerConnections.erase(i);
|
||||
|
||||
/** @todo: this is slow, find a better way (probably by creating reverse
|
||||
* lookup table(s))
|
||||
*/
|
||||
if (pid == m_dbProcessServerProcessId)
|
||||
else
|
||||
{
|
||||
DEBUG_REPORT_LOG(true, ("Database process died -- Central will exit and let the cluster restart\n"));
|
||||
m_done = true;
|
||||
return; //lint !e527 Unreachable
|
||||
DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null."));
|
||||
}
|
||||
|
||||
DEBUG_WARNING(true, ("Game server %lu crashed", pid));
|
||||
|
||||
for (SceneGameMap::iterator j = m_gameServers.begin(); j != m_gameServers.end();)
|
||||
{
|
||||
if ((*j).second == gameServer)
|
||||
m_gameServers.erase(j++);
|
||||
else
|
||||
++j;
|
||||
}
|
||||
|
||||
UniverseManager::getInstance().onGameServerDisconnect(*gameServer);
|
||||
PlanetManager::onGameServerDisconnect(gameServer);
|
||||
CharacterCreationTracker::getInstance().onGameServerDisconnect(pid);
|
||||
ClusterWideDataManagerList::onGameServerDisconnect(pid);
|
||||
|
||||
ExcommunicateGameServerMessage const excommunicateMessage(pid, 0, "");
|
||||
sendToAllGameServersExceptDBProcess(excommunicateMessage, true);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
@@ -1810,72 +1810,75 @@ void ChatServer::removeAvatarFromRoom(const NetworkId & id, const ChatAvatarId &
|
||||
ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeAvatarFromRoom() id(%s) avatarName(%s) roomName(%s)", id.getValueString().c_str(), avatarName.getFullName().c_str(), roomName.c_str());
|
||||
|
||||
const ChatAvatar * avatar = getAvatarByNetworkId(id);
|
||||
ChatAvatarId removerId;
|
||||
makeAvatarId(*avatar, removerId);
|
||||
size_t pos = roomName.rfind(".");
|
||||
std::string leaf;
|
||||
if(pos != std::string::npos)
|
||||
{
|
||||
leaf = toLower(roomName.substr(pos));
|
||||
}
|
||||
//REPORT_LOG(true, ("removeAvatarFromRoom()\n"));
|
||||
|
||||
if(avatar)
|
||||
{
|
||||
bool removeAvatar = false;
|
||||
if(avatarName == removerId)
|
||||
if (avatar != nullptr) {
|
||||
ChatAvatarId removerId;
|
||||
makeAvatarId(*avatar, removerId);
|
||||
size_t pos = roomName.rfind(".");
|
||||
std::string leaf;
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
// avatar is attempting to remove self from the room
|
||||
if(leaf != ".system")
|
||||
removeAvatar = true;
|
||||
leaf = toLower(roomName.substr(pos));
|
||||
}
|
||||
else if(isGod(id))
|
||||
//REPORT_LOG(true, ("removeAvatarFromRoom()\n"));
|
||||
|
||||
if (avatar)
|
||||
{
|
||||
removeAvatar = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName);
|
||||
if(r)
|
||||
bool removeAvatar = false;
|
||||
if (avatarName == removerId)
|
||||
{
|
||||
// if the avatar is the room owner, remove the target
|
||||
if( r->getRoomData().owner == removerId )
|
||||
{
|
||||
// avatar is attempting to remove self from the room
|
||||
if (leaf != ".system")
|
||||
removeAvatar = true;
|
||||
}
|
||||
// if the avatar is the room creator, remove the target
|
||||
else if( r->getRoomData().creator == removerId )
|
||||
}
|
||||
else if (isGod(id))
|
||||
{
|
||||
removeAvatar = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName);
|
||||
if (r)
|
||||
{
|
||||
removeAvatar = true;
|
||||
}
|
||||
// if the avatar is a moderator, remove the target
|
||||
else
|
||||
{
|
||||
/*MLSTODO if(r->getRoom())
|
||||
// if the avatar is the room owner, remove the target
|
||||
if (r->getRoomData().owner == removerId)
|
||||
{
|
||||
AvatarIterator i = r->getRoom()->getFirstModerator();
|
||||
for(; !i.outOfBounds(); ++i)
|
||||
{
|
||||
ChatAvatarId tmpAvatarId;
|
||||
makeAvatarId(*(*i), tmpAvatarId);
|
||||
if(tmpAvatarId == removerId)
|
||||
{
|
||||
removeAvatar = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
removeAvatar = true;
|
||||
}
|
||||
// if the avatar is the room creator, remove the target
|
||||
else if (r->getRoomData().creator == removerId)
|
||||
{
|
||||
removeAvatar = true;
|
||||
}
|
||||
// if the avatar is a moderator, remove the target
|
||||
else
|
||||
{
|
||||
/*MLSTODO if(r->getRoom())
|
||||
{
|
||||
AvatarIterator i = r->getRoom()->getFirstModerator();
|
||||
for(; !i.outOfBounds(); ++i)
|
||||
{
|
||||
ChatAvatarId tmpAvatarId;
|
||||
makeAvatarId(*(*i), tmpAvatarId);
|
||||
if(tmpAvatarId == removerId)
|
||||
{
|
||||
removeAvatar = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if(removeAvatar)
|
||||
{
|
||||
const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName);
|
||||
const NetworkId &id = getNetworkIdByAvatarId(avatarName);
|
||||
if (r)
|
||||
if (removeAvatar)
|
||||
{
|
||||
leaveRoom(id, 0, r->getRoomData().id);
|
||||
const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName);
|
||||
const NetworkId &id = getNetworkIdByAvatarId(avatarName);
|
||||
if (r)
|
||||
{
|
||||
leaveRoom(id, 0, r->getRoomData().id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ GenericAPICore::~GenericAPICore()
|
||||
delete (*iter).second;
|
||||
}
|
||||
|
||||
m_pending.empty();
|
||||
|
||||
while(m_outCount > 0)
|
||||
{
|
||||
delete m_outboundQueue.front().second;
|
||||
|
||||
+1
-1
@@ -542,7 +542,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e)
|
||||
wantCrc = UdpMisc::GetValue32(crcPtr);
|
||||
break;
|
||||
}
|
||||
if (wantCrc != actualCrc)
|
||||
if (wantCrc != actualCrc && mUdpManager != nullptr)
|
||||
{
|
||||
mConnectionStats.crcRejectedPackets++;
|
||||
mUdpManager->IncrementCrcRejectedPackets();
|
||||
|
||||
+12
-8
@@ -383,14 +383,18 @@ UdpPlatformAddress &UdpPlatformAddress::operator=(const UdpPlatformAddress &e)
|
||||
|
||||
char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const
|
||||
{
|
||||
if (bufferLen < 16)
|
||||
{
|
||||
*buffer = 0;
|
||||
return(buffer);
|
||||
}
|
||||
assert(buffer != NULL);
|
||||
sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]);
|
||||
return(buffer);
|
||||
if (buffer != nullptr) {
|
||||
if (bufferLen < 16)
|
||||
{
|
||||
*buffer = 0;
|
||||
return(buffer);
|
||||
}
|
||||
assert(buffer != NULL);
|
||||
sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]);
|
||||
return(buffer);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void UdpPlatformAddress::SetAddress(const char *address)
|
||||
|
||||
@@ -87,10 +87,10 @@ int UdpMisc::Crc32(const void *buffer, int bufferLen, int encryptValue)
|
||||
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D};
|
||||
|
||||
int crc = 0xffffffff;
|
||||
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ (encryptValue & 0xff)) & 0x000000FFL];
|
||||
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 8) & 0xff)) & 0x000000FFL];
|
||||
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 16) & 0xff)) & 0x000000FFL];
|
||||
crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 24) & 0xff)) & 0x000000FFL];
|
||||
crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ (encryptValue & 0xff)) & 0x000000FFL];
|
||||
crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ ((encryptValue >> 8) & 0xff)) & 0x000000FFL];
|
||||
crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ ((encryptValue >> 16) & 0xff)) & 0x000000FFL];
|
||||
crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ ((encryptValue >> 24) & 0xff)) & 0x000000FFL];
|
||||
|
||||
const udp_uchar *bufPtr = (const udp_uchar *)buffer;
|
||||
const udp_uchar *endPtr = (const udp_uchar *)buffer + bufferLen;
|
||||
|
||||
Reference in New Issue
Block a user