Added addVerifyPath function
This commit is contained in:
parent
060c226801
commit
5f14632818
17
src/GLua.cpp
17
src/GLua.cpp
@ -75,7 +75,6 @@ static void deinitialize() {
|
||||
SSLWebSocket::sslContext.release();
|
||||
}
|
||||
|
||||
|
||||
void luaPrint(ILuaBase* LUA, std::string str)
|
||||
{
|
||||
LUA->PushSpecial(GarrysMod::Lua::SPECIAL_GLOB);
|
||||
@ -153,7 +152,7 @@ LUA_FUNCTION(socketClose)
|
||||
return 0;
|
||||
}
|
||||
|
||||
LUA_FUNCTION (socketWrite)
|
||||
LUA_FUNCTION(socketWrite)
|
||||
{
|
||||
LUA->CheckString(2);
|
||||
GWSocket* socket = getCppObject<GWSocket>(LUA);
|
||||
@ -227,7 +226,7 @@ LUA_FUNCTION(socketIsConnected)
|
||||
return 1;
|
||||
}
|
||||
|
||||
LUA_FUNCTION (createWebSocket)
|
||||
LUA_FUNCTION(createWebSocket)
|
||||
{
|
||||
LUA->CheckString(1);
|
||||
std::string urlString = LUA->GetString(1);
|
||||
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -1 +1 @@
|
||||
1.1.2
|
||||
1.2.0
|
||||
|
Loading…
Reference in New Issue
Block a user