diff --git a/extension/extension.cpp b/extension/extension.cpp index 65370a8..7d97d16 100644 --- a/extension/extension.cpp +++ b/extension/extension.cpp @@ -280,7 +280,7 @@ void UploadCrashDump(const char *path) if (!xfer->PostAndDownload("http://crash.limetech.org/submit", form, &data, NULL)) { - printf(">>> UPLOAD FAILED\n"); + printf(">>> UPLOAD FAILED: %s (%d)\n", xfer->LastErrorMessage(), xfer->LastErrorCode()); } else { printf(">>> UPLOADED CRASH DUMP"); printf("%s", data.GetBuffer()); @@ -291,8 +291,11 @@ void UploadCrashDump(const char *path) } } -void Accelerator::OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax) +class UploadThread: public IThread { +void RunThread(IThreadHandle *pHandle) { + printf("Upload thread started.\n"); + IDirectory *dumps = libsys->OpenDirectory(buffer); char path[512]; @@ -340,6 +343,11 @@ void Accelerator::OnCoreMapStart(edict_t *pEdictList, int edictCount, int client } } +void OnTerminate(IThreadHandle *pHandle, bool cancel) { + printf("Upload thread terminated (%s)\n", (cancel ? "true" : "false")); +} +} uploadThread; + bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) { sharesys->AddDependency(myself, "webternet.ext", true, true); @@ -357,6 +365,8 @@ bool Accelerator::SDK_OnLoad(char *error, size_t maxlength, bool late) } } + threader->MakeThread(&uploadThread); + if (!gameconfs->LoadGameConfigFile("accelerator.games", &gameconfig, error, maxlength)) { return false; } diff --git a/extension/extension.h b/extension/extension.h index abd85ff..4cf0946 100644 --- a/extension/extension.h +++ b/extension/extension.h @@ -96,7 +96,6 @@ public: */ //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlen); #endif - virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax); }; #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ diff --git a/extension/sdk/smsdk_config.hpp b/extension/sdk/smsdk_config.hpp index 1bd3bd8..4b5114a 100644 --- a/extension/sdk/smsdk_config.hpp +++ b/extension/sdk/smsdk_config.hpp @@ -66,7 +66,7 @@ //#define SMEXT_ENABLE_MEMUTILS //#define SMEXT_ENABLE_GAMEHELPERS //#define SMEXT_ENABLE_TIMERSYS -//#define SMEXT_ENABLE_THREADER +#define SMEXT_ENABLE_THREADER #define SMEXT_ENABLE_LIBSYS //#define SMEXT_ENABLE_MENUS //#define SMEXT_ENABLE_ADTFACTORY