- sourcemod now intelligently unloads plugins which are leaking insane amounts of handles. these unloads get logged to sourcemod_fatal.log

- unloading is now delayed if a plugin is in the middle of a callstack

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401644
This commit is contained in:
David Anderson
2007-10-22 08:53:15 +00:00
parent 00ec666f18
commit af68caaf85
8 changed files with 149 additions and 28 deletions
+26
View File
@@ -1558,6 +1558,15 @@ bool CPluginManager::UnloadPlugin(IPlugin *plugin)
return false;
}
IPluginContext *pContext = plugin->GetBaseContext();
if (pContext->IsInExec())
{
char buffer[255];
UTIL_Format(buffer, sizeof(buffer), "sm plugins unload %s\n", plugin->GetFilename());
engine->ServerCommand(buffer);
return false;
}
/* Remove us from the lookup table and linked list */
m_plugins.remove(pPlugin);
sm_trie_delete(m_LoadLookup, pPlugin->m_filename);
@@ -2682,3 +2691,20 @@ void CPluginManager::UnloadAll()
UnloadPlugin((*iter));
}
}
int CPluginManager::GetOrderOfPlugin(IPlugin *pl)
{
int id = 1;
List<CPlugin *>::iterator iter;
for (iter = m_plugins.begin(); iter != m_plugins.end(); iter++, id++)
{
if ((*iter) == pl)
{
return id;
}
}
return -1;
}