mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-07 18:38:37 +00:00
Removed SourceHook dependencies
This commit is contained in:
parent
5e8f5a5405
commit
721ba97cd8
@ -5,7 +5,6 @@ libcurl = builder.RunScript('curl-src/lib/AMBuilder')
|
|||||||
|
|
||||||
binary = SM.ExtLibrary(builder, 'webternet.ext')
|
binary = SM.ExtLibrary(builder, 'webternet.ext')
|
||||||
binary.compiler.includes += [
|
binary.compiler.includes += [
|
||||||
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
|
||||||
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
|
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
|
||||||
]
|
]
|
||||||
binary.compiler.defines += ['CURL_STATICLIB']
|
binary.compiler.defines += ['CURL_STATICLIB']
|
||||||
|
|||||||
@ -37,7 +37,6 @@
|
|||||||
#include "curlapi.h"
|
#include "curlapi.h"
|
||||||
#include "FileDownloader.h"
|
#include "FileDownloader.h"
|
||||||
#include "MemoryDownloader.h"
|
#include "MemoryDownloader.h"
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -577,14 +576,14 @@ void HTTPSessionManager::PluginUnloaded(IPlugin *plugin)
|
|||||||
if (!requests.empty())
|
if (!requests.empty())
|
||||||
{
|
{
|
||||||
// Run through requests queue
|
// Run through requests queue
|
||||||
for (Queue<HTTPRequest>::iterator i(requests.begin()), end(requests.end()); i != end; ++i)
|
for (unsigned int i = 0; i < requests.length(); i++)
|
||||||
{
|
{
|
||||||
// Identify requests associated to (nearly) unmapped plugin context
|
// Identify requests associated to (nearly) unmapped plugin context
|
||||||
if (i->pCtx == plugin->GetBaseContext())
|
if (requests[i].pCtx == plugin->GetBaseContext())
|
||||||
{
|
{
|
||||||
// All context related data and callbacks are marked invalid
|
// All context related data and callbacks are marked invalid
|
||||||
i->pCtx = NULL;
|
requests[i].pCtx = NULL;
|
||||||
i->contextPack.pCallbackFunction = NULL;
|
requests[i].contextPack.pCallbackFunction = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -612,14 +611,15 @@ void HTTPSessionManager::PluginUnloaded(IPlugin *plugin)
|
|||||||
if (!callbacks.empty())
|
if (!callbacks.empty())
|
||||||
{
|
{
|
||||||
// Run through callback queue
|
// Run through callback queue
|
||||||
for (Queue<HTTPRequest>::iterator i(callbacks.begin()), end(callbacks.end()); i != end; ++i)
|
//for (Queue<HTTPRequest>::iterator i(callbacks.begin()), end(callbacks.end()); i != end; ++i)
|
||||||
|
for (unsigned int i = 0; i < callbacks.length(); i++)
|
||||||
{
|
{
|
||||||
// Identify callbacks associated to (nearly) unmapped plugin context
|
// Identify callbacks associated to (nearly) unmapped plugin context
|
||||||
if (i->pCtx == plugin->GetBaseContext())
|
if (callbacks[i].pCtx == plugin->GetBaseContext())
|
||||||
{
|
{
|
||||||
// All context related data and callbacks are marked invalid
|
// All context related data and callbacks are marked invalid
|
||||||
i->pCtx = NULL;
|
callbacks[i].pCtx = NULL;
|
||||||
i->contextPack.pCallbackFunction = NULL;
|
callbacks[i].contextPack.pCallbackFunction = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -645,7 +645,7 @@ void HTTPSessionManager::PostAndDownload(IPluginContext *pCtx,
|
|||||||
request.contextPack = contextPack;
|
request.contextPack = contextPack;
|
||||||
|
|
||||||
pRequestsLock->Lock();
|
pRequestsLock->Lock();
|
||||||
this->requests.push(request);
|
this->requests.append(request);
|
||||||
pRequestsLock->Unlock();
|
pRequestsLock->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ void HTTPSessionManager::Download(IPluginContext *pCtx,
|
|||||||
request.contextPack = contextPack;
|
request.contextPack = contextPack;
|
||||||
|
|
||||||
pRequestsLock->Lock();
|
pRequestsLock->Lock();
|
||||||
this->requests.push(request);
|
this->requests.append(request);
|
||||||
pRequestsLock->Unlock();
|
pRequestsLock->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ void HTTPSessionManager::RunFrame()
|
|||||||
{
|
{
|
||||||
if (!this->callbacks.empty())
|
if (!this->callbacks.empty())
|
||||||
{
|
{
|
||||||
HTTPRequest request = this->callbacks.first();
|
HTTPRequest request = this->callbacks.back();
|
||||||
IPluginContext *pCtx = request.pCtx;
|
IPluginContext *pCtx = request.pCtx;
|
||||||
|
|
||||||
// Is the requesting plugin still alive?
|
// Is the requesting plugin still alive?
|
||||||
@ -739,9 +739,9 @@ void HTTPSessionManager::RunFrame()
|
|||||||
{
|
{
|
||||||
// Create new thread object
|
// Create new thread object
|
||||||
HTTPAsyncRequestHandler *async =
|
HTTPAsyncRequestHandler *async =
|
||||||
new HTTPAsyncRequestHandler(this->requests.first());
|
new HTTPAsyncRequestHandler(this->requests.back());
|
||||||
// Skip requests with unloaded parent plugin
|
// Skip requests with unloaded parent plugin
|
||||||
if (this->requests.first().pCtx != NULL)
|
if (this->requests.back().pCtx != NULL)
|
||||||
{
|
{
|
||||||
// Create new thread
|
// Create new thread
|
||||||
IThreadHandle *pThread =
|
IThreadHandle *pThread =
|
||||||
@ -791,7 +791,7 @@ void HTTPSessionManager::Shutdown()
|
|||||||
void HTTPSessionManager::AddCallback(HTTPRequest request)
|
void HTTPSessionManager::AddCallback(HTTPRequest request)
|
||||||
{
|
{
|
||||||
this->pCallbacksLock->Lock();
|
this->pCallbacksLock->Lock();
|
||||||
this->callbacks.push(request);
|
this->callbacks.append(request);
|
||||||
this->pCallbacksLock->Unlock();
|
this->pCallbacksLock->Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
#include "IWebternet.h"
|
#include "IWebternet.h"
|
||||||
#include "IBaseDownloader.h"
|
#include "IBaseDownloader.h"
|
||||||
#include <amtl/am-linkedlist.h>
|
#include <amtl/am-linkedlist.h>
|
||||||
#include <sm_queue.h>
|
#include <amtl/am-vector.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
@ -241,11 +241,11 @@ private:
|
|||||||
|
|
||||||
static const unsigned int iMaxRequestsPerFrame = 20;
|
static const unsigned int iMaxRequestsPerFrame = 20;
|
||||||
IMutex *pRequestsLock;
|
IMutex *pRequestsLock;
|
||||||
Queue<HTTPRequest> requests;
|
ke::Vector<HTTPRequest> requests;
|
||||||
// NOTE: this needs no lock since it's only accessed from main thread
|
// NOTE: this needs no lock since it's only accessed from main thread
|
||||||
ke::LinkedList<IThreadHandle*> threads;
|
ke::LinkedList<IThreadHandle*> threads;
|
||||||
IMutex *pCallbacksLock;
|
IMutex *pCallbacksLock;
|
||||||
Queue<HTTPRequest> callbacks;
|
ke::Vector<HTTPRequest> callbacks;
|
||||||
|
|
||||||
class HTTPAsyncRequestHandler : public IThread
|
class HTTPAsyncRequestHandler : public IThread
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user