Fix memory leaks and errors
This commit is contained in:
parent
9451964046
commit
e08f1f1ba9
2
deps/mongoose
vendored
2
deps/mongoose
vendored
@ -1 +1 @@
|
||||
Subproject commit a478dc59354deb19d01a9e9138bcfac76a0347e3
|
||||
Subproject commit 421b420a0c159a8cbd027f87674b19f4a9b77993
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
||||
Subproject commit e0016c5b6ae61ad60d260a78c5834cc537b46d10
|
||||
Subproject commit c18aa7795a2e02ef700ff8b039d94ecdcc33432f
|
@ -28,16 +28,18 @@ namespace Components
|
||||
STATE_INVALID,
|
||||
};
|
||||
|
||||
struct AuthInfo
|
||||
class AuthInfo
|
||||
{
|
||||
public:
|
||||
Utils::Cryptography::ECC::Key publicKey;
|
||||
std::string challenge;
|
||||
AuthState state;
|
||||
int time;
|
||||
};
|
||||
|
||||
struct TokenIncrementing
|
||||
class TokenIncrementing
|
||||
{
|
||||
public:
|
||||
bool cancel;
|
||||
bool generating;
|
||||
std::thread thread;
|
||||
|
@ -10,8 +10,9 @@ namespace Components
|
||||
static bool Used();
|
||||
|
||||
private:
|
||||
struct Container
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
bool Evaluated;
|
||||
bool Invoked;
|
||||
std::string ConnectString;
|
||||
|
@ -10,8 +10,9 @@ namespace Components
|
||||
static void Perform();
|
||||
|
||||
private:
|
||||
struct Container
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
bool Perform;
|
||||
bool Terminate;
|
||||
std::thread Thread;
|
||||
|
@ -5,8 +5,9 @@ namespace Components
|
||||
public:
|
||||
typedef void(Callback)();
|
||||
|
||||
struct Flag
|
||||
{
|
||||
class Flag
|
||||
{
|
||||
public:
|
||||
Flag(Game::dvar_flag flag) : val(flag){};
|
||||
Flag(int flag) : Flag((Game::dvar_flag)flag) {};
|
||||
|
||||
|
@ -403,13 +403,16 @@ namespace Components
|
||||
|
||||
void Menus::RemoveMenu(Game::menuDef_t* menudef)
|
||||
{
|
||||
for (auto i = Menus::MenuList.begin(); i != Menus::MenuList.end(); ++i)
|
||||
for (auto i = Menus::MenuList.begin(); i != Menus::MenuList.end();)
|
||||
{
|
||||
if (i->second == menudef)
|
||||
{
|
||||
Menus::FreeMenu(menudef);
|
||||
i = Menus::MenuList.erase(i);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,12 +166,16 @@ namespace Components
|
||||
|
||||
void Node::DeleteInvalidSessions()
|
||||
{
|
||||
for (auto i = Node::Sessions.begin(); i != Node::Sessions.end(); ++i)
|
||||
for (auto i = Node::Sessions.begin(); i != Node::Sessions.end();)
|
||||
{
|
||||
if (i->lastTime <= 0 || (Game::Sys_Milliseconds() - i->lastTime) > SESSION_TIMEOUT)
|
||||
{
|
||||
i = Node::Sessions.erase(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,9 @@ namespace Components
|
||||
STATE_INVALID,
|
||||
};
|
||||
|
||||
struct NodeEntry
|
||||
class NodeEntry
|
||||
{
|
||||
public:
|
||||
Network::Address address;
|
||||
std::string challenge;
|
||||
Utils::Cryptography::ECC::Key publicKey;
|
||||
@ -52,8 +53,9 @@ namespace Components
|
||||
uint32_t version;
|
||||
};
|
||||
|
||||
struct ClientSession
|
||||
class ClientSession
|
||||
{
|
||||
public:
|
||||
Network::Address address;
|
||||
std::string challenge;
|
||||
bool valid;
|
||||
|
@ -17,8 +17,9 @@ namespace Components
|
||||
static void PlaylistError(std::string error);
|
||||
|
||||
private:
|
||||
struct JoinContainer
|
||||
class JoinContainer
|
||||
{
|
||||
public:
|
||||
Network::Address Target;
|
||||
std::string Challenge;
|
||||
DWORD JoinTime;
|
||||
|
@ -8,8 +8,9 @@ namespace Components
|
||||
const char* GetName() { return "RCon"; };
|
||||
|
||||
private:
|
||||
struct Container
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
int timestamp;
|
||||
std::string output;
|
||||
std::string challenge;
|
||||
|
@ -10,10 +10,12 @@ namespace Components
|
||||
static Utils::InfoString GetInfo();
|
||||
|
||||
private:
|
||||
struct Container
|
||||
class Container
|
||||
{
|
||||
struct Player
|
||||
public:
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
int Ping;
|
||||
int Score;
|
||||
std::string Name;
|
||||
|
@ -376,7 +376,7 @@ namespace Components
|
||||
{
|
||||
ServerList::RefreshContainer.Mutex.lock();
|
||||
|
||||
for (auto i = ServerList::RefreshContainer.Servers.begin(); i != ServerList::RefreshContainer.Servers.end(); ++i)
|
||||
for (auto i = ServerList::RefreshContainer.Servers.begin(); i != ServerList::RefreshContainer.Servers.end();)
|
||||
{
|
||||
// Our desired server
|
||||
if (i->Target == address && i->Sent)
|
||||
@ -412,22 +412,28 @@ namespace Components
|
||||
if (!list) return;
|
||||
|
||||
unsigned int k = 0;
|
||||
for (auto j = list->begin(); j != list->end(); ++j, ++k)
|
||||
for (auto j = list->begin(); j != list->end(); ++k)
|
||||
{
|
||||
if (j->Addr == address)
|
||||
{
|
||||
j = list->erase(j);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
// Also remove from visible list
|
||||
for (auto j = ServerList::VisibleList.begin(); j != ServerList::VisibleList.end(); ++j)
|
||||
for (auto j = ServerList::VisibleList.begin(); j != ServerList::VisibleList.end();)
|
||||
{
|
||||
if (*j == k)
|
||||
{
|
||||
j = ServerList::VisibleList.erase(j);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
@ -449,6 +455,10 @@ namespace Components
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
ServerList::RefreshContainer.Mutex.unlock();
|
||||
|
@ -5,8 +5,9 @@ namespace Components
|
||||
public:
|
||||
typedef int(SortCallback)(const void*, const void*);
|
||||
|
||||
struct ServerInfo
|
||||
class ServerInfo
|
||||
{
|
||||
public:
|
||||
Network::Address Addr;
|
||||
std::string Hostname;
|
||||
std::string Mapname;
|
||||
@ -73,10 +74,12 @@ namespace Components
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct Container
|
||||
class Container
|
||||
{
|
||||
struct ServerContainer
|
||||
public:
|
||||
class ServerContainer
|
||||
{
|
||||
public:
|
||||
bool Sent;
|
||||
int SendTime;
|
||||
std::string Challenge;
|
||||
|
@ -7,10 +7,12 @@ namespace Components
|
||||
const char* GetName() { return "Theatre"; };
|
||||
|
||||
private:
|
||||
struct Container
|
||||
class Container
|
||||
{
|
||||
struct DemoInfo
|
||||
public:
|
||||
class DemoInfo
|
||||
{
|
||||
public:
|
||||
std::string Name;
|
||||
std::string Mapname;
|
||||
std::string Gametype;
|
||||
|
@ -10,8 +10,9 @@ namespace Components
|
||||
static void Show(const char* image, const char* title, const char* description, int length);
|
||||
|
||||
private:
|
||||
struct UIToast
|
||||
class UIToast
|
||||
{
|
||||
public:
|
||||
std::string Image;
|
||||
std::string Title;
|
||||
std::string Desc;
|
||||
|
Loading…
Reference in New Issue
Block a user