mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 16:25:35 +00:00
clang-format everything
This commit is contained in:
parent
c9f5ee9729
commit
58e65cf43f
@ -2,10 +2,10 @@
|
|||||||
/// Created by Anonymous275 on 4/2/2020.
|
/// Created by Anonymous275 on 4/2/2020.
|
||||||
///
|
///
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "Security/Xor.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Security/Xor.h"
|
|
||||||
void InitLog();
|
void InitLog();
|
||||||
#define DebugPrintTID() DebugPrintTIDInternal(__func__, false)
|
#define DebugPrintTID() DebugPrintTIDInternal(__func__, false)
|
||||||
void DebugPrintTIDInternal(const std::string& func, bool overwrite = true); // prints the current thread id in debug mode, to make tracing of crashes and asserts easier
|
void DebugPrintTIDInternal(const std::string& func, bool overwrite = true); // prints the current thread id in debug mode, to make tracing of crashes and asserts easier
|
||||||
|
@ -17,4 +17,3 @@ using ReadLock = std::shared_lock<RWMutex>;
|
|||||||
// Construct with an RWMutex as a non-const reference.
|
// Construct with an RWMutex as a non-const reference.
|
||||||
// locks the mutex for writing. Construction may be blocking. Destruction is guaranteed to release the lock.
|
// locks the mutex for writing. Construction may be blocking. Destruction is guaranteed to release the lock.
|
||||||
using WriteLock = std::unique_lock<RWMutex>;
|
using WriteLock = std::unique_lock<RWMutex>;
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#else
|
#else
|
||||||
#include <WS2tcpip.h>
|
#include <WS2tcpip.h>
|
||||||
#endif
|
#endif
|
||||||
#include <string>
|
|
||||||
#include "Xor.h"
|
#include "Xor.h"
|
||||||
|
#include <string>
|
||||||
struct RSA {
|
struct RSA {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int e = 0;
|
int e = 0;
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
/// Created by Anonymous275 on 8/11/2020
|
/// Created by Anonymous275 on 8/11/2020
|
||||||
///
|
///
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#define BEGIN_NAMESPACE(x) namespace x {
|
#define BEGIN_NAMESPACE(x) namespace x {
|
||||||
#define END_NAMESPACE }
|
#define END_NAMESPACE }
|
||||||
@ -69,8 +69,9 @@ BEGIN_NAMESPACE(XorCompileTime)
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
template <size_t... Is>
|
template <size_t... Is>
|
||||||
constexpr inline XorString(const Char* str, std::index_sequence< Is... >) : _key(RandomChar< K >::value), _encrypted{ enc(str[Is])... }
|
constexpr inline XorString(const Char* str, std::index_sequence<Is...>)
|
||||||
{}
|
: _key(RandomChar<K>::value)
|
||||||
|
, _encrypted { enc(str[Is])... } { }
|
||||||
|
|
||||||
inline decltype(auto) decrypt() {
|
inline decltype(auto) decrypt() {
|
||||||
for (size_t i = 0; i < N; ++i) {
|
for (size_t i = 0; i < N; ++i) {
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
// ZeroMemory is just a {0} or a memset(addr, 0, len), and it's a macro on MSVC
|
// ZeroMemory is just a {0} or a memset(addr, 0, len), and it's a macro on MSVC
|
||||||
inline void ZeroMemory(void* dst, size_t len) {
|
inline void ZeroMemory(void* dst, size_t len) {
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
/// Created by Anonymous275 on 7/15/2020
|
/// Created by Anonymous275 on 7/15/2020
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <zlib.h>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <iostream>
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
#define Biggest 30000
|
#define Biggest 30000
|
||||||
std::string Comp(std::string Data) {
|
std::string Comp(std::string Data) {
|
||||||
|
22
src/Enc.cpp
22
src/Enc.cpp
@ -2,13 +2,13 @@
|
|||||||
/// Created by Anonymous275 on 7/28/2020
|
/// Created by Anonymous275 on 7/28/2020
|
||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
#include "Security/Enc.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
|
#include "Settings.h"
|
||||||
//#include <windows.h>
|
//#include <windows.h>
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include <random>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <random>
|
|
||||||
|
|
||||||
int Rand() {
|
int Rand() {
|
||||||
std::random_device r;
|
std::random_device r;
|
||||||
@ -20,7 +20,8 @@ int Rand(){
|
|||||||
int log_power(int n, unsigned int p, int mod) {
|
int log_power(int n, unsigned int p, int mod) {
|
||||||
int result = 1;
|
int result = 1;
|
||||||
for (; p; p >>= 1u) {
|
for (; p; p >>= 1u) {
|
||||||
if (p & 1u)result = int((1LL * result * n) % mod);
|
if (p & 1u)
|
||||||
|
result = int((1LL * result * n) % mod);
|
||||||
n = int((1LL * n * n) % mod);
|
n = int((1LL * n * n) % mod);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -36,7 +37,8 @@ bool rabin_miller(int n){
|
|||||||
}
|
}
|
||||||
int generate_prime() {
|
int generate_prime() {
|
||||||
int generated = Rand();
|
int generated = Rand();
|
||||||
while (!rabin_miller(generated))generated = Rand();
|
while (!rabin_miller(generated))
|
||||||
|
generated = Rand();
|
||||||
return generated;
|
return generated;
|
||||||
}
|
}
|
||||||
int gcd(int a, int b) {
|
int gcd(int a, int b) {
|
||||||
@ -50,19 +52,22 @@ int gcd(int a, int b){
|
|||||||
|
|
||||||
int generate_coprime(int n) {
|
int generate_coprime(int n) {
|
||||||
int generated = Rand();
|
int generated = Rand();
|
||||||
while (gcd(n, generated) != 1)generated = Rand();
|
while (gcd(n, generated) != 1)
|
||||||
|
generated = Rand();
|
||||||
return generated;
|
return generated;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<int, int> euclid_extended(int a, int b) {
|
std::pair<int, int> euclid_extended(int a, int b) {
|
||||||
if(!b)return {1, 0};
|
if (!b)
|
||||||
|
return { 1, 0 };
|
||||||
auto result = euclid_extended(b, a % b);
|
auto result = euclid_extended(b, a % b);
|
||||||
return { result.second, result.first - (a / b) * result.second };
|
return { result.second, result.first - (a / b) * result.second };
|
||||||
}
|
}
|
||||||
|
|
||||||
int modular_inverse(int n, int mod) {
|
int modular_inverse(int n, int mod) {
|
||||||
int inverse = euclid_extended(n, mod).first;
|
int inverse = euclid_extended(n, mod).first;
|
||||||
while(inverse < 0)inverse += mod;
|
while (inverse < 0)
|
||||||
|
inverse += mod;
|
||||||
return inverse;
|
return inverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +123,8 @@ std::string RSA_D(const std::string& Data, RSA*k){
|
|||||||
std::stringstream ss(Data);
|
std::stringstream ss(Data);
|
||||||
std::string token, ret;
|
std::string token, ret;
|
||||||
while (std::getline(ss, token, 'g')) {
|
while (std::getline(ss, token, 'g')) {
|
||||||
if(token.find_first_not_of(Sec("0123456789abcdef")) != std::string::npos)return "";
|
if (token.find_first_not_of(Sec("0123456789abcdef")) != std::string::npos)
|
||||||
|
return "";
|
||||||
int c = std::stoi(token, nullptr, 16);
|
int c = std::stoi(token, nullptr, 16);
|
||||||
ret += char(Dec(c, k->d, k->n));
|
ret += char(Dec(c, k->d, k->n));
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 7/28/2020
|
/// Created by Anonymous275 on 7/28/2020
|
||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Logger.h"
|
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
#include "Security/Enc.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -22,14 +22,19 @@ void SetValues(const std::string& Line, int Index) {
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
std::string Data;
|
std::string Data;
|
||||||
bool Switch = false;
|
bool Switch = false;
|
||||||
if (Index > 5)Switch = true;
|
if (Index > 5)
|
||||||
|
Switch = true;
|
||||||
for (char c : Line) {
|
for (char c : Line) {
|
||||||
if (Switch) {
|
if (Switch) {
|
||||||
if (c == '\"')state++;
|
if (c == '\"')
|
||||||
if (state > 0 && state < 2)Data += c;
|
state++;
|
||||||
|
if (state > 0 && state < 2)
|
||||||
|
Data += c;
|
||||||
} else {
|
} else {
|
||||||
if (c == ' ')state++;
|
if (c == ' ')
|
||||||
if (state > 1)Data += c;
|
state++;
|
||||||
|
if (state > 1)
|
||||||
|
Data += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Data = Data.substr(1);
|
Data = Data.substr(1);
|
||||||
@ -72,7 +77,8 @@ void SetValues(const std::string& Line, int Index) {
|
|||||||
std::string RemoveComments(const std::string& Line) {
|
std::string RemoveComments(const std::string& Line) {
|
||||||
std::string Return;
|
std::string Return;
|
||||||
for (char c : Line) {
|
for (char c : Line) {
|
||||||
if(c == '#')break;
|
if (c == '#')
|
||||||
|
break;
|
||||||
Return += c;
|
Return += c;
|
||||||
}
|
}
|
||||||
return Return;
|
return Return;
|
||||||
@ -139,13 +145,17 @@ void DebugData(){
|
|||||||
void InitConfig() {
|
void InitConfig() {
|
||||||
std::ifstream IFS;
|
std::ifstream IFS;
|
||||||
IFS.open(Sec("Server.cfg"));
|
IFS.open(Sec("Server.cfg"));
|
||||||
if(IFS.good())LoadConfig(IFS);
|
if (IFS.good())
|
||||||
else Default();
|
LoadConfig(IFS);
|
||||||
if(IFS.is_open())IFS.close();
|
else
|
||||||
|
Default();
|
||||||
|
if (IFS.is_open())
|
||||||
|
IFS.close();
|
||||||
if (Key.empty()) {
|
if (Key.empty()) {
|
||||||
error(Sec("No AuthKey was found"));
|
error(Sec("No AuthKey was found"));
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
_Exit(0);
|
_Exit(0);
|
||||||
}
|
}
|
||||||
if(Debug)DebugData();
|
if (Debug)
|
||||||
|
DebugData();
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 7/28/2020
|
/// Created by Anonymous275 on 7/28/2020
|
||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Curl/Http.h"
|
|
||||||
#include "Client.hpp"
|
#include "Client.hpp"
|
||||||
#include "Settings.h"
|
#include "Curl/Http.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include <sstream>
|
#include "Security/Enc.h"
|
||||||
#include <thread>
|
#include "Settings.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <future>
|
#include <future>
|
||||||
|
#include <sstream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
void WebsocketInit();
|
void WebsocketInit();
|
||||||
std::string GetPlayers() {
|
std::string GetPlayers() {
|
||||||
@ -39,7 +39,8 @@ std::string RunPromise(const std::string& IP, const std::string& R) {
|
|||||||
std::thread t(std::move(task));
|
std::thread t(std::move(task));
|
||||||
t.detach();
|
t.detach();
|
||||||
auto status = f1.wait_for(std::chrono::seconds(10));
|
auto status = f1.wait_for(std::chrono::seconds(10));
|
||||||
if (status != std::future_status::timeout)return f1.get();
|
if (status != std::future_status::timeout)
|
||||||
|
return f1.get();
|
||||||
error(Sec("Backend system Timeout please try again later"));
|
error(Sec("Backend system Timeout please try again later"));
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
_Exit(0);
|
_Exit(0);
|
||||||
@ -51,7 +52,8 @@ void Heartbeat(){
|
|||||||
bool isAuth = false;
|
bool isAuth = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
R = GenerateCall();
|
R = GenerateCall();
|
||||||
if(!CustomIP.empty())R+="&ip="+CustomIP;
|
if (!CustomIP.empty())
|
||||||
|
R += "&ip=" + CustomIP;
|
||||||
std::string link = Sec("https://beammp.com/heartbeatv2");
|
std::string link = Sec("https://beammp.com/heartbeatv2");
|
||||||
T = RunPromise(link, R);
|
T = RunPromise(link, R);
|
||||||
if (T.find_first_not_of(Sec("20")) != std::string::npos) {
|
if (T.find_first_not_of(Sec("20")) != std::string::npos) {
|
||||||
@ -66,7 +68,8 @@ void Heartbeat(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Server Authenticated
|
//Server Authenticated
|
||||||
if(T.length() == 4)info(Sec("Server authenticated"));
|
if (T.length() == 4)
|
||||||
|
info(Sec("Server authenticated"));
|
||||||
R.clear();
|
R.clear();
|
||||||
T.clear();
|
T.clear();
|
||||||
if (!isAuth) {
|
if (!isAuth) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 7/28/2020
|
/// Created by Anonymous275 on 7/28/2020
|
||||||
///
|
///
|
||||||
|
#include "Logger.h"
|
||||||
#include "Security/Enc.h"
|
#include "Security/Enc.h"
|
||||||
#include <filesystem>
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Logger.h"
|
#include <filesystem>
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
@ -16,7 +16,8 @@ int ModsLoaded = 0;
|
|||||||
|
|
||||||
void InitRes() {
|
void InitRes() {
|
||||||
std::string Path = Resource + Sec("/Client");
|
std::string Path = Resource + Sec("/Client");
|
||||||
if(!fs::exists(Path))fs::create_directory(Path);
|
if (!fs::exists(Path))
|
||||||
|
fs::create_directory(Path);
|
||||||
for (const auto& entry : fs::directory_iterator(Path)) {
|
for (const auto& entry : fs::directory_iterator(Path)) {
|
||||||
auto pos = entry.path().string().find(Sec(".zip"));
|
auto pos = entry.path().string().find(Sec(".zip"));
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 7/28/2020
|
/// Created by Anonymous275 on 7/28/2020
|
||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Client.hpp"
|
#include "Client.hpp"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include <string>
|
#include "Security/Enc.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
std::string CustomIP;
|
std::string CustomIP;
|
||||||
std::string GetSVer() {
|
std::string GetSVer() {
|
||||||
@ -25,7 +25,8 @@ void Args(int argc, char* argv[]){
|
|||||||
if (p != std::string::npos || n != 3 || CustomIP.substr(0, 3) == Sec("127")) {
|
if (p != std::string::npos || n != 3 || CustomIP.substr(0, 3) == Sec("127")) {
|
||||||
CustomIP.clear();
|
CustomIP.clear();
|
||||||
warn(Sec("IP Specified is invalid! Ignoring"));
|
warn(Sec("IP Specified is invalid! Ignoring"));
|
||||||
}else info(Sec("Server started with custom IP"));
|
} else
|
||||||
|
info(Sec("Server started with custom IP"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void InitServer(int argc, char* argv[]) {
|
void InitServer(int argc, char* argv[]) {
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include "UnixCompat.h"
|
#include "UnixCompat.h"
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <utility>
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
std::unique_ptr<LuaArg> CreateArg(lua_State* L, int T, int S) {
|
std::unique_ptr<LuaArg> CreateArg(lua_State* L, int T, int S) {
|
||||||
if (S > T)
|
if (S > T)
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 7/31/2020
|
/// Created by Anonymous275 on 7/31/2020
|
||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Curl/Http.h"
|
#include "Curl/Http.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include "Network.h"
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include <sstream>
|
#include "Network.h"
|
||||||
#include <thread>
|
#include "Security/Enc.h"
|
||||||
#include <cstring>
|
#include "Settings.h"
|
||||||
#include <algorithm>
|
|
||||||
#include <string>
|
|
||||||
#include <atomic>
|
|
||||||
#include "UnixCompat.h"
|
#include "UnixCompat.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <atomic>
|
||||||
|
#include <cstring>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
bool Send(SOCKET TCPSock, std::string Data) {
|
bool Send(SOCKET TCPSock, std::string Data) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -68,11 +67,13 @@ std::string GetRole(const std::string &DID){
|
|||||||
std::string a = HttpRequest(Sec("https://beammp.com/entitlement?did=") + DID, 443);
|
std::string a = HttpRequest(Sec("https://beammp.com/entitlement?did=") + DID, 443);
|
||||||
std::string b = HttpRequest(Sec("https://backup1.beammp.com/entitlement?did=") + DID, 443);
|
std::string b = HttpRequest(Sec("https://backup1.beammp.com/entitlement?did=") + DID, 443);
|
||||||
if (!a.empty() || !b.empty()) {
|
if (!a.empty() || !b.empty()) {
|
||||||
if(a != b)a = b;
|
if (a != b)
|
||||||
|
a = b;
|
||||||
auto pos = a.find('"');
|
auto pos = a.find('"');
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
return a.substr(pos + 1, a.find('"', pos + 1) - 2);
|
return a.substr(pos + 1, a.find('"', pos + 1) - 2);
|
||||||
}else if(a == "[]")return Sec("Member");
|
} else if (a == "[]")
|
||||||
|
return Sec("Member");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
@ -94,7 +95,8 @@ int Max(){
|
|||||||
int M = MaxPlayers;
|
int M = MaxPlayers;
|
||||||
for (auto& c : CI->Clients) {
|
for (auto& c : CI->Clients) {
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if(c->GetRole() == Sec("MDEV"))M++;
|
if (c->GetRole() == Sec("MDEV"))
|
||||||
|
M++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return M;
|
return M;
|
||||||
@ -114,12 +116,14 @@ std::pair<int,int> Parse(const std::string& msg){
|
|||||||
std::string t;
|
std::string t;
|
||||||
std::pair<int, int> a = { 0, 0 }; //N then E
|
std::pair<int, int> a = { 0, 0 }; //N then E
|
||||||
while (std::getline(ss, t, 'g')) {
|
while (std::getline(ss, t, 'g')) {
|
||||||
if(t.find_first_not_of(Sec("0123456789abcdef")) != std::string::npos)return a;
|
if (t.find_first_not_of(Sec("0123456789abcdef")) != std::string::npos)
|
||||||
|
return a;
|
||||||
if (a.first == 0) {
|
if (a.first == 0) {
|
||||||
a.first = std::stoi(t, nullptr, 16);
|
a.first = std::stoi(t, nullptr, 16);
|
||||||
} else if (a.second == 0) {
|
} else if (a.second == 0) {
|
||||||
a.second = std::stoi(t, nullptr, 16);
|
a.second = std::stoi(t, nullptr, 16);
|
||||||
}else return a;
|
} else
|
||||||
|
return a;
|
||||||
}
|
}
|
||||||
return { 0, 0 };
|
return { 0, 0 };
|
||||||
}
|
}
|
||||||
|
@ -103,4 +103,3 @@ void Client::SetCarData(int ident,const std::string&Data){
|
|||||||
int Client::GetCarCount() {
|
int Client::GetCarCount() {
|
||||||
return int(VehicleData.size());
|
return int(VehicleData.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 8/1/2020
|
/// Created by Anonymous275 on 8/1/2020
|
||||||
///
|
///
|
||||||
#include "Lua/LuaSystem.hpp"
|
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Client.hpp"
|
#include "Client.hpp"
|
||||||
#include "Settings.h"
|
|
||||||
#include "Network.h"
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "Lua/LuaSystem.hpp"
|
||||||
|
#include "Network.h"
|
||||||
|
#include "Security/Enc.h"
|
||||||
|
#include "Settings.h"
|
||||||
#include "UnixCompat.h"
|
#include "UnixCompat.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
int FC(const std::string& s, const std::string& p, int n) {
|
int FC(const std::string& s, const std::string& p, int n) {
|
||||||
auto i = s.find(p);
|
auto i = s.find(p);
|
||||||
int j;
|
int j;
|
||||||
for (j = 1; j < n && i != std::string::npos; ++j) {
|
for (j = 1; j < n && i != std::string::npos; ++j) {
|
||||||
i = s.find(p, i + 1);
|
i = s.find(p, i + 1);
|
||||||
}
|
}
|
||||||
if (j == n)return int(i);
|
if (j == n)
|
||||||
else return -1;
|
return int(i);
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
void Apply(Client* c, int VID, const std::string& pckt) {
|
void Apply(Client* c, int VID, const std::string& pckt) {
|
||||||
Assert(c);
|
Assert(c);
|
||||||
std::string Packet = pckt;
|
std::string Packet = pckt;
|
||||||
std::string VD = c->GetCarData(VID);
|
std::string VD = c->GetCarData(VID);
|
||||||
Packet = Packet.substr(FC(Packet, ",", 2) + 1);
|
Packet = Packet.substr(FC(Packet, ",", 2) + 1);
|
||||||
Packet = VD.substr(0, FC(VD, ",", 2) + 1) +
|
Packet = VD.substr(0, FC(VD, ",", 2) + 1) + Packet.substr(0, Packet.find_last_of('"') + 1) + VD.substr(FC(VD, ",\"", 7));
|
||||||
Packet.substr(0, Packet.find_last_of('"') + 1) +
|
|
||||||
VD.substr(FC(VD, ",\"", 7));
|
|
||||||
c->SetCarData(VID, Packet);
|
c->SetCarData(VID, Packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VehicleParser(Client* c, const std::string& Pckt) {
|
void VehicleParser(Client* c, const std::string& Pckt) {
|
||||||
Assert(c);
|
Assert(c);
|
||||||
if(c == nullptr || Pckt.length() < 4)return;
|
if (c == nullptr || Pckt.length() < 4)
|
||||||
|
return;
|
||||||
std::string Packet = Pckt;
|
std::string Packet = Pckt;
|
||||||
char Code = Packet.at(1);
|
char Code = Packet.at(1);
|
||||||
int PID = -1;
|
int PID = -1;
|
||||||
@ -49,10 +49,7 @@ void VehicleParser(Client*c,const std::string& Pckt){
|
|||||||
int CarID = c->GetOpenCarID();
|
int CarID = c->GetOpenCarID();
|
||||||
debug(c->GetName() + Sec(" created a car with ID ") + std::to_string(CarID));
|
debug(c->GetName() + Sec(" created a car with ID ") + std::to_string(CarID));
|
||||||
Packet = "Os:" + c->GetRole() + ":" + c->GetName() + ":" + std::to_string(c->GetID()) + "-" + std::to_string(CarID) + Packet.substr(4);
|
Packet = "Os:" + c->GetRole() + ":" + c->GetName() + ":" + std::to_string(c->GetID()) + "-" + std::to_string(CarID) + Packet.substr(4);
|
||||||
if(c->GetCarCount() >= MaxCars ||
|
if (c->GetCarCount() >= MaxCars || TriggerLuaEvent(Sec("onVehicleSpawn"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID(), CarID, Packet.substr(3) } }), true)) {
|
||||||
TriggerLuaEvent(Sec("onVehicleSpawn"),false,nullptr,
|
|
||||||
std::make_unique<LuaArg>(LuaArg{{c->GetID(),CarID,Packet.substr(3)}}),
|
|
||||||
true)){
|
|
||||||
Respond(c, Packet, true);
|
Respond(c, Packet, true);
|
||||||
std::string Destroy = "Od:" + std::to_string(c->GetID()) + "-" + std::to_string(CarID);
|
std::string Destroy = "Od:" + std::to_string(c->GetID()) + "-" + std::to_string(CarID);
|
||||||
Respond(c, Destroy, true);
|
Respond(c, Destroy, true);
|
||||||
@ -119,7 +116,8 @@ void VehicleParser(Client*c,const std::string& Pckt){
|
|||||||
}
|
}
|
||||||
void SyncClient(Client* c) {
|
void SyncClient(Client* c) {
|
||||||
Assert(c);
|
Assert(c);
|
||||||
if(c->isSynced)return;
|
if (c->isSynced)
|
||||||
|
return;
|
||||||
c->isSynced = true;
|
c->isSynced = true;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
Respond(c, Sec("Sn") + c->GetName(), true);
|
Respond(c, Sec("Sn") + c->GetName(), true);
|
||||||
@ -166,14 +164,16 @@ void HandleEvent(Client*c ,const std::string&Data){
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(a == 2)break;
|
if (a == 2)
|
||||||
|
break;
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalParser(Client* c, const std::string& Pack) {
|
void GlobalParser(Client* c, const std::string& Pack) {
|
||||||
Assert(c);
|
Assert(c);
|
||||||
if(Pack.empty() || c == nullptr)return;
|
if (Pack.empty() || c == nullptr)
|
||||||
|
return;
|
||||||
std::string Packet = Pack.substr(0, strlen(Pack.c_str()));
|
std::string Packet = Pack.substr(0, strlen(Pack.c_str()));
|
||||||
std::string pct;
|
std::string pct;
|
||||||
char Code = Packet.at(0);
|
char Code = Packet.at(0);
|
||||||
@ -212,11 +212,13 @@ void GlobalParser(Client*c, const std::string& Pack){
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug(std::string(Sec("got 'C' packet: '")) + Pack + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
|
debug(std::string(Sec("got 'C' packet: '")) + Pack + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
|
||||||
#endif
|
#endif
|
||||||
if(Packet.length() < 4 || Packet.find(':', 3) == std::string::npos)break;
|
if (Packet.length() < 4 || Packet.find(':', 3) == std::string::npos)
|
||||||
|
break;
|
||||||
if (TriggerLuaEvent(Sec("onChatMessage"), false, nullptr,
|
if (TriggerLuaEvent(Sec("onChatMessage"), false, nullptr,
|
||||||
std::unique_ptr<LuaArg>(new LuaArg {
|
std::unique_ptr<LuaArg>(new LuaArg {
|
||||||
{c->GetID(), c->GetName(), Packet.substr(Packet.find(':', 3) + 1)}
|
{ c->GetID(), c->GetName(), Packet.substr(Packet.find(':', 3) + 1) } }),
|
||||||
}),true))break;
|
true))
|
||||||
|
break;
|
||||||
SendToAll(nullptr, Packet, true, true);
|
SendToAll(nullptr, Packet, true, true);
|
||||||
return;
|
return;
|
||||||
case 'E':
|
case 'E':
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
/// Created by Anonymous275 on 4/9/2020
|
/// Created by Anonymous275 on 4/9/2020
|
||||||
///
|
///
|
||||||
|
|
||||||
#include <curl/curl.h>
|
|
||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
|
#include <curl/curl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
|
static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
|
||||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||||
@ -22,7 +22,8 @@ std::string HttpRequest(const std::string& IP,int port){
|
|||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
if(res != CURLE_OK)return "-1";
|
if (res != CURLE_OK)
|
||||||
|
return "-1";
|
||||||
}
|
}
|
||||||
return readBuffer;
|
return readBuffer;
|
||||||
}
|
}
|
||||||
@ -44,7 +45,8 @@ std::string PostHTTP(const std::string& IP,const std::string& Fields){
|
|||||||
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
if(res != CURLE_OK)return "-1";
|
if (res != CURLE_OK)
|
||||||
|
return "-1";
|
||||||
}
|
}
|
||||||
return readBuffer;
|
return readBuffer;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 8/1/2020
|
/// Created by Anonymous275 on 8/1/2020
|
||||||
///
|
///
|
||||||
#include "Lua/LuaSystem.hpp"
|
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Client.hpp"
|
#include "Client.hpp"
|
||||||
#include "Settings.h"
|
|
||||||
#include "Network.h"
|
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "Lua/LuaSystem.hpp"
|
||||||
|
#include "Network.h"
|
||||||
|
#include "Security/Enc.h"
|
||||||
|
#include "Settings.h"
|
||||||
int OpenID() {
|
int OpenID() {
|
||||||
int ID = 0;
|
int ID = 0;
|
||||||
bool found;
|
bool found;
|
||||||
@ -37,17 +37,20 @@ void Respond(Client* c, const std::string& MSG, bool Rel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SendToAll(Client* c, const std::string& Data, bool Self, bool Rel) {
|
void SendToAll(Client* c, const std::string& Data, bool Self, bool Rel) {
|
||||||
if (!Self)Assert(c);
|
if (!Self)
|
||||||
|
Assert(c);
|
||||||
char C = Data.at(0);
|
char C = Data.at(0);
|
||||||
for (auto& client : CI->Clients) {
|
for (auto& client : CI->Clients) {
|
||||||
if (client != nullptr) {
|
if (client != nullptr) {
|
||||||
if (Self || client.get() != c) {
|
if (Self || client.get() != c) {
|
||||||
if (client->isSynced) {
|
if (client->isSynced) {
|
||||||
if (Rel || C == 'W' || C == 'Y' || C == 'V' || C == 'E') {
|
if (Rel || C == 'W' || C == 'Y' || C == 'V' || C == 'E') {
|
||||||
if (C == 'O' || C == 'T' ||
|
if (C == 'O' || C == 'T' || Data.length() > 1000)
|
||||||
Data.length() > 1000)SendLarge(client.get(), Data);
|
SendLarge(client.get(), Data);
|
||||||
else TCPSend(client.get(), Data);
|
else
|
||||||
} else UDPSend(client.get(), Data);
|
TCPSend(client.get(), Data);
|
||||||
|
} else
|
||||||
|
UDPSend(client.get(), Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +59,8 @@ void SendToAll(Client*c, const std::string& Data, bool Self, bool Rel){
|
|||||||
void UpdatePlayers() {
|
void UpdatePlayers() {
|
||||||
std::string Packet = Sec("Ss") + std::to_string(CI->Size()) + "/" + std::to_string(MaxPlayers) + ":";
|
std::string Packet = Sec("Ss") + std::to_string(CI->Size()) + "/" + std::to_string(MaxPlayers) + ":";
|
||||||
for (auto& c : CI->Clients) {
|
for (auto& c : CI->Clients) {
|
||||||
if(c != nullptr)Packet += c->GetName() + ",";
|
if (c != nullptr)
|
||||||
|
Packet += c->GetName() + ",";
|
||||||
}
|
}
|
||||||
Packet = Packet.substr(0, Packet.length() - 1);
|
Packet = Packet.substr(0, Packet.length() - 1);
|
||||||
SendToAll(nullptr, Packet, true, true);
|
SendToAll(nullptr, Packet, true, true);
|
||||||
@ -65,7 +69,8 @@ void OnDisconnect(Client*c,bool kicked){
|
|||||||
|
|
||||||
Assert(c);
|
Assert(c);
|
||||||
info(c->GetName() + Sec(" Connection Terminated"));
|
info(c->GetName() + Sec(" Connection Terminated"));
|
||||||
if(c == nullptr)return;
|
if (c == nullptr)
|
||||||
|
return;
|
||||||
std::string Packet;
|
std::string Packet;
|
||||||
for (auto& v : c->GetAllCars()) {
|
for (auto& v : c->GetAllCars()) {
|
||||||
if (v != nullptr) {
|
if (v != nullptr) {
|
||||||
@ -73,7 +78,8 @@ void OnDisconnect(Client*c,bool kicked){
|
|||||||
SendToAll(c, Packet, false, true);
|
SendToAll(c, Packet, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(kicked)Packet = Sec("L")+c->GetName()+Sec(" was kicked!");
|
if (kicked)
|
||||||
|
Packet = Sec("L") + c->GetName() + Sec(" was kicked!");
|
||||||
Packet = Sec("L") + c->GetName() + Sec(" Left the server!");
|
Packet = Sec("L") + c->GetName() + Sec(" Left the server!");
|
||||||
SendToAll(c, Packet, false, true);
|
SendToAll(c, Packet, false, true);
|
||||||
Packet.clear();
|
Packet.clear();
|
||||||
@ -87,7 +93,8 @@ void OnConnect(Client*c){
|
|||||||
info(Sec("Assigned ID ") + std::to_string(c->GetID()) + Sec(" to ") + c->GetName());
|
info(Sec("Assigned ID ") + std::to_string(c->GetID()) + Sec(" to ") + c->GetName());
|
||||||
TriggerLuaEvent(Sec("onPlayerConnecting"), false, nullptr, std::unique_ptr<LuaArg>(new LuaArg { { c->GetID() } }), false);
|
TriggerLuaEvent(Sec("onPlayerConnecting"), false, nullptr, std::unique_ptr<LuaArg>(new LuaArg { { c->GetID() } }), false);
|
||||||
SyncResources(c);
|
SyncResources(c);
|
||||||
if(c->GetStatus() < 0)return;
|
if (c->GetStatus() < 0)
|
||||||
|
return;
|
||||||
Respond(c, "M" + MapName, true); //Send the Map on connect
|
Respond(c, "M" + MapName, true); //Send the Map on connect
|
||||||
info(c->GetName() + Sec(" : Connected"));
|
info(c->GetName() + Sec(" : Connected"));
|
||||||
TriggerLuaEvent(Sec("onPlayerJoining"), false, nullptr, std::unique_ptr<LuaArg>(new LuaArg { { c->GetID() } }), false);
|
TriggerLuaEvent(Sec("onPlayerJoining"), false, nullptr, std::unique_ptr<LuaArg>(new LuaArg { { c->GetID() } }), false);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "Network.h"
|
#include "Network.h"
|
||||||
#include <thread>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <thread>
|
||||||
std::unique_ptr<ClientInterface> CI;
|
std::unique_ptr<ClientInterface> CI;
|
||||||
void NetMain() {
|
void NetMain() {
|
||||||
std::thread TCP(TCPServerMain);
|
std::thread TCP(TCPServerMain);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 6/18/2020
|
/// Created by Anonymous275 on 6/18/2020
|
||||||
///
|
///
|
||||||
#include "Security/Enc.h"
|
|
||||||
#include "Client.hpp"
|
#include "Client.hpp"
|
||||||
|
#include "Security/Enc.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
///
|
///
|
||||||
/// Created by Anonymous275 on 8/1/2020
|
/// Created by Anonymous275 on 8/1/2020
|
||||||
///
|
///
|
||||||
|
#include "Compressor.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
#include "Network.h"
|
||||||
#include "Security/Enc.h"
|
#include "Security/Enc.h"
|
||||||
#include "UnixCompat.h"
|
#include "UnixCompat.h"
|
||||||
#include "Compressor.h"
|
|
||||||
#include "Network.h"
|
|
||||||
#include "Logger.h"
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
|
||||||
void TCPSend(Client* c, const std::string& Data) {
|
void TCPSend(Client* c, const std::string& Data) {
|
||||||
Assert(c);
|
Assert(c);
|
||||||
if(c == nullptr)return;
|
if (c == nullptr)
|
||||||
|
return;
|
||||||
// Size is BIG ENDIAN now, use only for header!
|
// Size is BIG ENDIAN now, use only for header!
|
||||||
//auto Size = htonl(int32_t(Data.size()));
|
//auto Size = htonl(int32_t(Data.size()));
|
||||||
///TODO : BIG ENDIAN for other OS
|
///TODO : BIG ENDIAN for other OS
|
||||||
@ -25,10 +25,12 @@ void TCPSend(Client*c,const std::string&Data){
|
|||||||
do {
|
do {
|
||||||
Temp = send(c->GetTCPSock(), &Send[Sent], Size - Sent, 0);
|
Temp = send(c->GetTCPSock(), &Send[Sent], Size - Sent, 0);
|
||||||
if (Temp == 0) {
|
if (Temp == 0) {
|
||||||
if (c->GetStatus() > -1)c->SetStatus(-1);
|
if (c->GetStatus() > -1)
|
||||||
|
c->SetStatus(-1);
|
||||||
return;
|
return;
|
||||||
} else if (Temp < 0) {
|
} else if (Temp < 0) {
|
||||||
if (c->GetStatus() > -1)c->SetStatus(-1);
|
if (c->GetStatus() > -1)
|
||||||
|
c->SetStatus(-1);
|
||||||
info(Sec("Closing socket, Temp < 0"));
|
info(Sec("Closing socket, Temp < 0"));
|
||||||
closesocket(c->GetTCPSock());
|
closesocket(c->GetTCPSock());
|
||||||
return;
|
return;
|
||||||
@ -41,7 +43,8 @@ bool CheckBytes(Client*c,int32_t BytesRcv){
|
|||||||
Assert(c);
|
Assert(c);
|
||||||
if (BytesRcv == 0) {
|
if (BytesRcv == 0) {
|
||||||
debug(Sec("(TCP) Connection closing..."));
|
debug(Sec("(TCP) Connection closing..."));
|
||||||
if(c->GetStatus() > -1)c->SetStatus(-1);
|
if (c->GetStatus() > -1)
|
||||||
|
c->SetStatus(-1);
|
||||||
return false;
|
return false;
|
||||||
} else if (BytesRcv < 0) {
|
} else if (BytesRcv < 0) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -49,7 +52,8 @@ bool CheckBytes(Client*c,int32_t BytesRcv){
|
|||||||
#else // unix
|
#else // unix
|
||||||
debug(Sec("(TCP) recv failed with error: ") + std::string(strerror(errno)));
|
debug(Sec("(TCP) recv failed with error: ") + std::string(strerror(errno)));
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
if(c->GetStatus() > -1)c->SetStatus(-1);
|
if (c->GetStatus() > -1)
|
||||||
|
c->SetStatus(-1);
|
||||||
info(Sec("Closing socket in CheckBytes, BytesRcv < 0"));
|
info(Sec("Closing socket in CheckBytes, BytesRcv < 0"));
|
||||||
closesocket(c->GetTCPSock());
|
closesocket(c->GetTCPSock());
|
||||||
return false;
|
return false;
|
||||||
@ -60,7 +64,8 @@ bool CheckBytes(Client*c,int32_t BytesRcv){
|
|||||||
void TCPRcv(Client* c) {
|
void TCPRcv(Client* c) {
|
||||||
Assert(c);
|
Assert(c);
|
||||||
int32_t Header, BytesRcv = 0, Temp;
|
int32_t Header, BytesRcv = 0, Temp;
|
||||||
if(c == nullptr || c->GetStatus() < 0)return;
|
if (c == nullptr || c->GetStatus() < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
std::vector<char> Data(sizeof(Header));
|
std::vector<char> Data(sizeof(Header));
|
||||||
do {
|
do {
|
||||||
@ -122,7 +127,8 @@ void TCPClient(Client*c){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OnConnect(c);
|
OnConnect(c);
|
||||||
while (c->GetStatus() > -1)TCPRcv(c);
|
while (c->GetStatus() > -1)
|
||||||
|
TCPRcv(c);
|
||||||
OnDisconnect(c, c->GetStatus() == -2);
|
OnDisconnect(c, c->GetStatus() == -2);
|
||||||
}
|
}
|
||||||
void InitClient(Client* c) {
|
void InitClient(Client* c) {
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
/// Created by Anonymous275 on 11/6/2020
|
/// Created by Anonymous275 on 11/6/2020
|
||||||
///
|
///
|
||||||
/*#include <boost/beast/core.hpp>
|
/*#include <boost/beast/core.hpp>
|
||||||
#include <boost/beast/websocket.hpp>
|
#include "Logger.h"
|
||||||
|
#include "Security/Enc.h"
|
||||||
#include <boost/asio/connect.hpp>
|
#include <boost/asio/connect.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>*/
|
#include <boost/asio/ip/tcp.hpp>*/
|
||||||
#include "Security/Enc.h"
|
#include <boost/beast/websocket.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Logger.h"
|
|
||||||
#include <thread>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
/*namespace beast = boost::beast;
|
/*namespace beast = boost::beast;
|
||||||
namespace http = beast::http;
|
namespace http = beast::http;
|
||||||
@ -50,9 +50,7 @@ void SyncData(){
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WebsocketInit() {
|
void WebsocketInit() {
|
||||||
/*std::thread t1(SyncData);
|
/*std::thread t1(SyncData);
|
||||||
t1.detach();*/
|
t1.detach();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
/// Created by Anonymous275 on 7/17/2020
|
/// Created by Anonymous275 on 7/17/2020
|
||||||
///
|
///
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
|
#include "RWMutex.h"
|
||||||
#include "Security/Enc.h"
|
#include "Security/Enc.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@ -10,7 +11,6 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "RWMutex.h"
|
|
||||||
|
|
||||||
static RWMutex ThreadNameMapMutex;
|
static RWMutex ThreadNameMapMutex;
|
||||||
static std::unordered_map<std::thread::id, std::string> ThreadNameMap;
|
static std::unordered_map<std::thread::id, std::string> ThreadNameMap;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "CustomAssert.h"
|
#include "CustomAssert.h"
|
||||||
#include <curl/curl.h>
|
#include "Security/Xor.h"
|
||||||
#include "Startup.h"
|
#include "Startup.h"
|
||||||
|
#include <curl/curl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include "Security/Xor.h"
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
void UnixSignalHandler(int sig) {
|
void UnixSignalHandler(int sig) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user