Added addVerifyPath function

This commit is contained in:
Fredy 2020-06-28 00:50:07 +02:00
parent 060c226801
commit 5f14632818
4 changed files with 19 additions and 6 deletions

View File

@ -75,7 +75,6 @@ static void deinitialize() {
SSLWebSocket::sslContext.release();
}
void luaPrint(ILuaBase* LUA, std::string str)
{
LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
@ -253,6 +252,16 @@ LUA_FUNCTION (createWebSocket)
}
}
LUA_FUNCTION(addVerifyPath) {
std::string path = LUA->CheckString(1);
boost::system::error_code ec;
if (SSLWebSocket::sslContext->add_verify_path(path, ec))
{
std::string errorMessage = "Failed setting SSL verify path: " + ec.message();
throwErrorNoHalt(LUA, errorMessage);
}
}
void pcall(ILuaBase* LUA, int numArgs)
{
if (LUA->PCall(numArgs, 0, 0))
@ -382,6 +391,8 @@ GMOD_MODULE_OPEN()
LUA->CreateTable();
LUA->PushCFunction(createWebSocket);
LUA->SetField(-2, "createWebSocket");
LUA->PushCFunction(addVerifyPath);
LUA->SetField(-2, "addVerifyPath");
LUA->SetField(-2, "GWSockets");
LUA->Pop();

View File

@ -46,7 +46,9 @@ bool GWSocket::close()
std::lock_guard<std::recursive_mutex> guard(this->queueMutex);
this->writeQueue.emplace_back(OUT_DISCONNECT);
}
if (expected == STATE_CONNECTED) {
//If we are connecting we do not have to checkWriting, because it will be done upon completion/error instead.
if (expected != STATE_CONNECTING)
{
this->checkWriting();
}
return true;

View File

@ -2,7 +2,7 @@
//I'm trying to make this as easy for anyone to adapt to their own module
//So if you want to use this, feel free
#define MODULE_VERSION "1.1.3" //The version of the current build
#define MODULE_VERSION "1.2.0" //The version of the current build
#define MODULE_VERSION_URL "https://raw.githubusercontent.com/FredyH/GWSockets/master/version.txt" //A URL to a txt file containing only the version number of the latest version
#define MODULE_NAME "GWSockets" //The name of this program
#define MODULE_RELEASE_URL "https://github.com/FredyH/GWSockets/releases" //A URL to the latest releases

View File

@ -1 +1 @@
1.1.2
1.2.0