more cleanup

This commit is contained in:
Anonymous275
2020-12-20 14:11:29 +02:00
parent 2e7f2cc6bd
commit 97d8f9506e
32 changed files with 289 additions and 421 deletions

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 7/31/2020
///
@@ -190,30 +194,30 @@ void TCPServerMain() {
addr.sin_family = AF_INET;
addr.sin_port = htons(uint16_t(Port));
if (bind(Listener, (sockaddr*)&addr, sizeof(addr)) != 0) {
error(Sec("Can't bind socket! ") + std::string(strerror(errno)));
error(("Can't bind socket! ") + std::string(strerror(errno)));
std::this_thread::sleep_for(std::chrono::seconds(5));
_Exit(-1);
}
if (Listener == -1) {
error(Sec("Invalid listening socket"));
error(("Invalid listening socket"));
return;
}
if (listen(Listener, SOMAXCONN)) {
error(Sec("listener failed ") + std::string(strerror(errno)));
error(("listener failed ") + std::string(strerror(errno)));
return;
}
info(Sec("Vehicle event network online"));
info(("Vehicle event network online"));
do {
try {
client = accept(Listener, nullptr, nullptr);
if (client == -1) {
warn(Sec("Got an invalid client socket on connect! Skipping..."));
warn(("Got an invalid client socket on connect! Skipping..."));
continue;
}
std::thread ID(Identify, client);
ID.detach();
} catch (const std::exception& e) {
error(Sec("fatal: ") + std::string(e.what()));
error(("fatal: ") + std::string(e.what()));
}
} while (client);

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 5/8/2020
///

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 8/1/2020
///
@@ -43,18 +47,18 @@ void VehicleParser(Client* c, const std::string& Pckt) {
switch (Code) { //Spawned Destroyed Switched/Moved NotFound Reset
case 's':
#ifdef DEBUG
debug(std::string(Sec("got 'Os' packet: '")) + Packet + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'Os' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
if (Data.at(0) == '0') {
int CarID = c->GetOpenCarID();
debug(c->GetName() + Sec(" created a car with ID ") + std::to_string(CarID));
debug(c->GetName() + (" created a car with ID ") + std::to_string(CarID));
Packet = "Os:" + c->GetRoles() + ":" + c->GetName() + ":" + std::to_string(c->GetID()) + "-" + std::to_string(CarID) + Packet.substr(4);
auto Res = TriggerLuaEvent(Sec("onVehicleSpawn"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID(), CarID, Packet.substr(3) } }), true);
auto Res = TriggerLuaEvent(("onVehicleSpawn"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID(), CarID, Packet.substr(3) } }), true);
if (c->GetCarCount() >= MaxCars || std::any_cast<int>(Res)) {
Respond(c, Packet, true);
std::string Destroy = "Od:" + std::to_string(c->GetID()) + "-" + std::to_string(CarID);
Respond(c, Destroy, true);
debug(c->GetName() + Sec(" (force : car limit/lua) removed ID ") + std::to_string(CarID));
debug(c->GetName() + (" (force : car limit/lua) removed ID ") + std::to_string(CarID));
} else {
c->AddNewCar(CarID, Packet);
SendToAll(nullptr, Packet, true, true);
@@ -63,7 +67,7 @@ void VehicleParser(Client* c, const std::string& Pckt) {
return;
case 'c':
#ifdef DEBUG
debug(std::string(Sec("got 'Oc' packet: '")) + Packet + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'Oc' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
pid = Data.substr(0, Data.find('-'));
vid = Data.substr(Data.find('-') + 1, Data.find(':', 1) - Data.find('-') - 1);
@@ -72,7 +76,7 @@ void VehicleParser(Client* c, const std::string& Pckt) {
VID = stoi(vid);
}
if (PID != -1 && VID != -1 && PID == c->GetID()) {
auto Res = TriggerLuaEvent(Sec("onVehicleEdited"), false, nullptr,
auto Res = TriggerLuaEvent(("onVehicleEdited"), false, nullptr,
std::make_unique<LuaArg>(LuaArg { { c->GetID(), VID, Packet.substr(3) } }),
true);
if (!std::any_cast<int>(Res)) {
@@ -87,7 +91,7 @@ void VehicleParser(Client* c, const std::string& Pckt) {
return;
case 'd':
#ifdef DEBUG
debug(std::string(Sec("got 'Od' packet: '")) + Packet + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'Od' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
pid = Data.substr(0, Data.find('-'));
vid = Data.substr(Data.find('-') + 1);
@@ -97,27 +101,27 @@ void VehicleParser(Client* c, const std::string& Pckt) {
}
if (PID != -1 && VID != -1 && PID == c->GetID()) {
SendToAll(nullptr, Packet, true, true);
TriggerLuaEvent(Sec("onVehicleDeleted"), false, nullptr,
TriggerLuaEvent(("onVehicleDeleted"), false, nullptr,
std::make_unique<LuaArg>(LuaArg { { c->GetID(), VID } }), false);
c->DeleteCar(VID);
debug(c->GetName() + Sec(" deleted car with ID ") + std::to_string(VID));
debug(c->GetName() + (" deleted car with ID ") + std::to_string(VID));
}
return;
case 'r':
#ifdef DEBUG
debug(std::string(Sec("got 'Or' packet: '")) + Packet + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'Or' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
SendToAll(c, Packet, false, true);
return;
case 't':
#ifdef DEBUG
debug(std::string(Sec("got 'Ot' packet: '")) + Packet + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'Ot' packet: '")) + Packet + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
SendToAll(c, Packet, false, true);
return;
default:
#ifdef DEBUG
warn(std::string(Sec("possibly not implemented: '") + Packet + Sec("' (") + std::to_string(Packet.size()) + Sec(")")));
warn(std::string(("possibly not implemented: '") + Packet + ("' (") + std::to_string(Packet.size()) + (")")));
#endif // DEBUG
return;
}
@@ -128,9 +132,9 @@ void SyncClient(Client* c) {
return;
c->isSynced = true;
std::this_thread::sleep_for(std::chrono::seconds(1));
Respond(c, Sec("Sn") + c->GetName(), true);
SendToAll(c, Sec("JWelcome ") + c->GetName() + "!", false, true);
TriggerLuaEvent(Sec("onPlayerJoin"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID() } }), false);
Respond(c, ("Sn") + c->GetName(), true);
SendToAll(c, ("JWelcome ") + c->GetName() + "!", false, true);
TriggerLuaEvent(("onPlayerJoin"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID() } }), false);
for (auto& client : CI->Clients) {
if (client != nullptr) {
if (client.get() != c) {
@@ -144,14 +148,14 @@ void SyncClient(Client* c) {
}
}
}
info(c->GetName() + Sec(" is now synced!"));
info(c->GetName() + (" is now synced!"));
}
void ParseVeh(Client* c, const std::string& Packet) {
Assert(c);
#ifdef WIN32
__try {
VehicleParser(c, Packet);
} __except (Handle(GetExceptionInformation(), Sec("Vehicle Handler"))) { }
} __except (Handle(GetExceptionInformation(), ("Vehicle Handler"))) { }
#else // unix
VehicleParser(c, Packet);
#endif // WIN32
@@ -202,24 +206,24 @@ void GlobalParser(Client* c, const std::string& Pack) {
SyncClient(c);
return;
case 'p':
Respond(c, Sec("p"), false);
Respond(c, ("p"), false);
UpdatePlayers();
return;
case 'O':
if (Packet.length() > 1000) {
debug(Sec("Received data from: ") + c->GetName() + Sec(" Size: ") + std::to_string(Packet.length()));
debug(("Received data from: ") + c->GetName() + (" Size: ") + std::to_string(Packet.length()));
}
ParseVeh(c, Packet);
return;
case 'J':
#ifdef DEBUG
debug(std::string(Sec("got 'J' packet: '")) + Pack + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'J' packet: '")) + Pack + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
SendToAll(c, Packet, false, true);
return;
case 'C':
#ifdef DEBUG
debug(std::string(Sec("got 'C' packet: '")) + Pack + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'C' packet: '")) + Pack + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
if (Packet.length() < 4 || Packet.find(':', 3) == std::string::npos)
break;
@@ -231,7 +235,7 @@ void GlobalParser(Client* c, const std::string& Pack) {
return;
case 'E':
#ifdef DEBUG
debug(std::string(Sec("got 'E' packet: '")) + Pack + Sec("' (") + std::to_string(Packet.size()) + Sec(")"));
debug(std::string(("got 'E' packet: '")) + Pack + ("' (") + std::to_string(Packet.size()) + (")"));
#endif
HandleEvent(c, Packet);
return;
@@ -248,7 +252,7 @@ void GParser(Client* c, const std::string& Packet) {
#ifdef WIN32
__try {
GlobalParser(c, Packet);
} __except (Handle(GetExceptionInformation(), Sec("Global Handler"))) { }
} __except (Handle(GetExceptionInformation(), ("Global Handler"))) { }
#else
GlobalParser(c, Packet);
#endif // WIN32

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 4/9/2020
///

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 8/1/2020
///
@@ -9,8 +13,6 @@
#include "Logger.h"
#include <memory>
int OpenID() {
int ID = 0;
bool found;
@@ -61,7 +63,7 @@ void SendToAll(Client* c, const std::string& Data, bool Self, bool Rel) {
}
}
void UpdatePlayers() {
std::string Packet = Sec("Ss") + std::to_string(CI->Size()) + "/" + std::to_string(MaxPlayers) + ":";
std::string Packet = ("Ss") + std::to_string(CI->Size()) + "/" + std::to_string(MaxPlayers) + ":";
for (auto& c : CI->Clients) {
if (c != nullptr)
Packet += c->GetName() + ",";
@@ -71,7 +73,7 @@ void UpdatePlayers() {
}
void OnDisconnect(Client* c, bool kicked) {
Assert(c);
info(c->GetName() + Sec(" Connection Terminated"));
info(c->GetName() + (" Connection Terminated"));
std::string Packet;
for (auto& v : c->GetAllCars()) {
if (v != nullptr) {
@@ -80,14 +82,14 @@ void OnDisconnect(Client* c, bool kicked) {
}
}
if (kicked)
Packet = Sec("L") + c->GetName() + Sec(" was kicked!");
Packet = Sec("L") + c->GetName() + Sec(" Left the server!");
Packet = ("L") + c->GetName() + (" was kicked!");
Packet = ("L") + c->GetName() + (" Left the server!");
SendToAll(c, Packet, false, true);
Packet.clear();
TriggerLuaEvent(Sec("onPlayerDisconnect"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID() } }), false);
TriggerLuaEvent(("onPlayerDisconnect"), false, nullptr, std::make_unique<LuaArg>(LuaArg { { c->GetID() } }), false);
if(c->GetTCPSock())CloseSocketProper(c->GetTCPSock());
if(c->GetDownSock())CloseSocketProper(c->GetDownSock());
CI->RemoveClient(c); ///Removes the Client from existence
CI->RemoveClient(c);
}
void OnConnect(Client* c) {
Assert(c);

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 6/18/2020
///

View File

@@ -1,6 +1,11 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 8/1/2020
///
#include "Security/Enc.h"
#include "UnixCompat.h"
#include "Settings.h"
@@ -73,7 +78,7 @@ void SendFile(Client*c, const std::string& Name) {
///Wait for connections
int T = 0;
while(c->GetDownSock() < 1 && T < 30){
while(c->GetDownSock() < 1 && T < 50){
std::this_thread::sleep_for(std::chrono::milliseconds(100));
T++;
}
@@ -109,7 +114,7 @@ void Parse(Client* c, const std::string& Packet) {
return;
case 'S':
if (SubCode == 'R') {
debug(Sec("Sending Mod Info"));
debug("Sending Mod Info");
std::string ToSend = FileList + FileSizes;
if (ToSend.empty())ToSend = "-";
TCPSend(c, ToSend);

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 8/1/2020
///
@@ -45,13 +49,13 @@ bool CheckBytes(Client* c, int32_t BytesRcv) {
return false;
} else if (BytesRcv < 0) {
#ifdef WIN32
debug(Sec("(TCP) recv failed with error: ") + std::to_string(WSAGetLastError()));
debug(("(TCP) recv failed with error: ") + std::to_string(WSAGetLastError()));
#else // unix
debug(Sec("(TCP) recv failed with error: ") + std::string(strerror(errno)));
debug(("(TCP) recv failed with error: ") + std::string(strerror(errno)));
#endif // WIN32
if (c->GetStatus() > -1)
c->SetStatus(-1);
info(Sec("Closing socket in CheckBytes, BytesRcv < 0"));
info(("Closing socket in CheckBytes, BytesRcv < 0"));
CloseSocketProper(c->GetTCPSock());
return false;
}
@@ -69,7 +73,7 @@ std::string TCPRcv(Client* c) {
Temp = recv(c->GetTCPSock(), &Data[BytesRcv], 4 - BytesRcv, 0);
if (!CheckBytes(c, Temp)) {
#ifdef DEBUG
error(std::string(__func__) + Sec(": failed on CheckBytes in while(BytesRcv < 4)"));
error(std::string(__func__) + (": failed on CheckBytes in while(BytesRcv < 4)"));
#endif // DEBUG
return "";
}
@@ -78,11 +82,11 @@ std::string TCPRcv(Client* c) {
memcpy(&Header, &Data[0], sizeof(Header));
#ifdef DEBUG
//debug(std::string(__func__) + Sec(": expecting ") + std::to_string(Header) + Sec(" bytes."));
//debug(std::string(__func__) + (": expecting ") + std::to_string(Header) + (" bytes."));
#endif // DEBUG
if (!CheckBytes(c, BytesRcv)) {
#ifdef DEBUG
error(std::string(__func__) + Sec(": failed on CheckBytes"));
error(std::string(__func__) + (": failed on CheckBytes"));
#endif // DEBUG
return "";
}
@@ -92,18 +96,18 @@ std::string TCPRcv(Client* c) {
Temp = recv(c->GetTCPSock(), &Data[BytesRcv], Header - BytesRcv, 0);
if (!CheckBytes(c, Temp)) {
#ifdef DEBUG
error(std::string(__func__) + Sec(": failed on CheckBytes in while(BytesRcv < Header)"));
error(std::string(__func__) + (": failed on CheckBytes in while(BytesRcv < Header)"));
#endif // DEBUG
return "";
}
#ifdef DEBUG
//debug(std::string(__func__) + Sec(": Temp: ") + std::to_string(Temp) + Sec(", BytesRcv: ") + std::to_string(BytesRcv));
//debug(std::string(__func__) + (": Temp: ") + std::to_string(Temp) + (", BytesRcv: ") + std::to_string(BytesRcv));
#endif // DEBUG
BytesRcv += Temp;
} while (BytesRcv < Header);
#ifdef DEBUG
//debug(std::string(__func__) + Sec(": finished recv with Temp: ") + std::to_string(Temp) + Sec(", BytesRcv: ") + std::to_string(BytesRcv));
//debug(std::string(__func__) + (": finished recv with Temp: ") + std::to_string(Temp) + (", BytesRcv: ") + std::to_string(BytesRcv));
#endif // DEBUG
std::string Ret(Data.data(), Header);

View File

@@ -1,20 +1,24 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 5/8/2020
///
///UDP
#include "Client.hpp"
#include "Compressor.h"
#include "Logger.h"
#include "Network.h"
#include "Security/Enc.h"
#include "Settings.h"
#include "Compressor.h"
#include "UnixCompat.h"
#include <array>
#include <cmath>
#include "Client.hpp"
#include "Settings.h"
#include "Network.h"
#include "Logger.h"
#include <cstring>
#include <sstream>
#include <thread>
#include <vector>
#include <cmath>
int FC(const std::string& s, const std::string& p, int n);
SOCKET UDPSock;
@@ -39,21 +43,21 @@ void UDPSend(Client* c, std::string Data) {
sendOk = sendto(UDPSock, Data.c_str(), len, 0, (sockaddr*)&Addr, AddrSize);
#ifdef WIN32
if (sendOk == -1) {
debug(Sec("(UDP) Send Failed Code : ") + std::to_string(WSAGetLastError()));
debug(("(UDP) Send Failed Code : ") + std::to_string(WSAGetLastError()));
if (c->GetStatus() > -1)
c->SetStatus(-1);
} else if (sendOk == 0) {
debug(Sec("(UDP) sendto returned 0"));
debug(("(UDP) sendto returned 0"));
if (c->GetStatus() > -1)
c->SetStatus(-1);
}
#else // unix
if (sendOk == -1) {
debug(Sec("(UDP) Send Failed Code : ") + std::string(strerror(errno)));
debug(("(UDP) Send Failed Code : ") + std::string(strerror(errno)));
if (c->GetStatus() > -1)
c->SetStatus(-1);
} else if (sendOk == 0) {
debug(Sec("(UDP) sendto returned 0"));
debug(("(UDP) sendto returned 0"));
if (c->GetStatus() > -1)
c->SetStatus(-1);
}
@@ -77,9 +81,9 @@ std::string UDPRcvFromClient(sockaddr_in& client) {
int64_t Rcv = recvfrom(UDPSock, &Ret[0], 10240, 0, (sockaddr*)&client, (socklen_t*)&clientLength);
if (Rcv == -1) {
#ifdef WIN32
error(Sec("(UDP) Error receiving from Client! Code : ") + std::to_string(WSAGetLastError()));
error(("(UDP) Error receiving from Client! Code : ") + std::to_string(WSAGetLastError()));
#else // unix
error(Sec("(UDP) Error receiving from Client! Code : ") + std::string(strerror(errno)));
error(("(UDP) Error receiving from Client! Code : ") + std::string(strerror(errno)));
#endif // WIN32
return "";
}
@@ -102,7 +106,7 @@ void UDPParser(Client* c, std::string Packet) {
#ifdef WIN32
WSADATA data;
if (WSAStartup(514, &data)) {
error(Sec("Can't start Winsock!"));
error(("Can't start Winsock!"));
//return;
}
@@ -115,13 +119,13 @@ void UDPParser(Client* c, std::string Packet) {
// Try and bind the socket to the IP and port
if (bind(UDPSock, (sockaddr*)&serverAddr, sizeof(serverAddr)) == SOCKET_ERROR) {
error(Sec("Can't bind socket!") + std::to_string(WSAGetLastError()));
error(("Can't bind socket!") + std::to_string(WSAGetLastError()));
std::this_thread::sleep_for(std::chrono::seconds(5));
_Exit(-1);
//return;
}
info(Sec("Vehicle data network online on port ") + std::to_string(Port) + Sec(" with a Max of ") + std::to_string(MaxPlayers) + Sec(" Clients"));
info(("Vehicle data network online on port ") + std::to_string(Port) + (" with a Max of ") + std::to_string(MaxPlayers) + (" Clients"));
while (true) {
try {
sockaddr_in client {};
@@ -141,7 +145,7 @@ void UDPParser(Client* c, std::string Packet) {
}
}
} catch (const std::exception& e) {
error(Sec("fatal: ") + std::string(e.what()));
error(("fatal: ") + std::string(e.what()));
}
}
/*CloseSocketProper(UDPSock);
@@ -157,13 +161,13 @@ void UDPParser(Client* c, std::string Packet) {
// Try and bind the socket to the IP and port
if (bind(UDPSock, (sockaddr*)&serverAddr, sizeof(serverAddr)) != 0) {
error(Sec("Can't bind socket!") + std::string(strerror(errno)));
error(("Can't bind socket!") + std::string(strerror(errno)));
std::this_thread::sleep_for(std::chrono::seconds(5));
_Exit(-1);
//return;
}
info(Sec("Vehicle data network online on port ") + std::to_string(Port) + Sec(" with a Max of ") + std::to_string(MaxPlayers) + Sec(" Clients"));
info(("Vehicle data network online on port ") + std::to_string(Port) + (" with a Max of ") + std::to_string(MaxPlayers) + (" Clients"));
while (true) {
try {
sockaddr_in client {};
@@ -183,7 +187,7 @@ void UDPParser(Client* c, std::string Packet) {
}
}
} catch (const std::exception& e) {
error(Sec("fatal: ") + std::string(e.what()));
error(("fatal: ") + std::string(e.what()));
}
}
/*CloseSocketProper(UDPSock); // TODO: Why not this? We did this in TCPServerMain?

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2020 Anonymous275.
// BeamMP Server code is not in the public domain and is not free software.
// One must be granted explicit permission by the copyright holder in order to modify or distribute any part of the source or binaries.
// Anything else is prohibited. Modified works may not be published and have be upstreamed to the official repository.
///
/// Created by Anonymous275 on 11/6/2020
///
@@ -24,13 +28,13 @@ std::string GetRes(const beast::flat_buffer& buff) {
void SyncData() {
/*DebugPrintTID();
try {
std::string const host = Sec("95.216.35.232");
std::string const host = ("95.216.35.232");
net::io_context ioc;
tcp::resolver r(ioc);
websocket::stream<tcp::socket> ws(ioc);
auto const results = r.resolve(host, Sec("3600"));
auto const results = r.resolve(host, ("3600"));
net::connect(ws.next_layer(), results.begin(), results.end());