mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2025-08-18 12:45:36 +00:00
Server now support over 9 Petabytes of mod
This commit is contained in:
parent
6c93ea7fb2
commit
e7c1bdd872
@ -6,7 +6,7 @@
|
|||||||
#include "LuaSystem.hpp"
|
#include "LuaSystem.hpp"
|
||||||
#include "../logger.h"
|
#include "../logger.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <future>
|
||||||
|
|
||||||
LuaArg* CreateArg(lua_State *L,int T){
|
LuaArg* CreateArg(lua_State *L,int T){
|
||||||
LuaArg* temp = new LuaArg;
|
LuaArg* temp = new LuaArg;
|
||||||
@ -118,8 +118,10 @@ int lua_CreateThread(lua_State *L){
|
|||||||
if(Args > 0){
|
if(Args > 0){
|
||||||
if(lua_isstring(L,1)) {
|
if(lua_isstring(L,1)) {
|
||||||
std::string STR = lua_tostring(L,1);
|
std::string STR = lua_tostring(L,1);
|
||||||
std::thread Worker(CallAsync,GetScript(L),STR,CreateArg(L,Args));
|
std::thread t1(CallAsync,GetScript(L),STR,CreateArg(L,Args));
|
||||||
Worker.detach();
|
t1.detach();
|
||||||
|
//auto s = std::async();
|
||||||
|
///TODO FIGURE OUT THREAD
|
||||||
}else SendError(L,"CreateThread wrong argument [1] need string");
|
}else SendError(L,"CreateThread wrong argument [1] need string");
|
||||||
}else SendError(L,"CreateThread not enough arguments");
|
}else SendError(L,"CreateThread not enough arguments");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -39,7 +39,7 @@ void TCPRcv(Client*c){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OnConnect(Client*c);
|
void OnConnect(Client*c);
|
||||||
void OnDisconnect(Client*c,bool Timed);
|
void OnDisconnect(Client*c,bool kicked);
|
||||||
void TCPClient(Client*client){
|
void TCPClient(Client*client){
|
||||||
if(client->GetTCPSock() == -1)return;
|
if(client->GetTCPSock() == -1)return;
|
||||||
std::cout << "Client connected" << std::endl;
|
std::cout << "Client connected" << std::endl;
|
||||||
|
@ -92,6 +92,13 @@ void Identification(SOCKET TCPSock){
|
|||||||
Name = Res.substr(2,Res.find(':')-2);
|
Name = Res.substr(2,Res.find(':')-2);
|
||||||
DID = Res.substr(Res.find(':')+1);
|
DID = Res.substr(Res.find(':')+1);
|
||||||
Role = HTTP(DID);
|
Role = HTTP(DID);
|
||||||
|
for(Client*c: Clients){
|
||||||
|
if(c->GetDID() == DID){
|
||||||
|
closesocket(c->GetTCPSock());
|
||||||
|
c->SetStatus(-2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(Role.empty() || Role.find("Error") != std::string::npos){
|
if(Role.empty() || Role.find("Error") != std::string::npos){
|
||||||
closesocket(TCPSock);
|
closesocket(TCPSock);
|
||||||
return;
|
return;
|
||||||
@ -101,7 +108,9 @@ void Identification(SOCKET TCPSock){
|
|||||||
CreateClient(TCPSock,Name,DID,Role);
|
CreateClient(TCPSock,Name,DID,Role);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Clients.size() < Max())CreateClient(TCPSock,Name,DID,Role);
|
if(Clients.size() < Max()){
|
||||||
|
CreateClient(TCPSock,Name,DID,Role);
|
||||||
|
}else closesocket(TCPSock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCPServerMain(){
|
void TCPServerMain(){
|
||||||
|
@ -10,7 +10,7 @@ namespace fs = std::filesystem;
|
|||||||
std::string FileList;
|
std::string FileList;
|
||||||
std::string FileSizes;
|
std::string FileSizes;
|
||||||
int ModsLoaded = 0;
|
int ModsLoaded = 0;
|
||||||
int MaxModSize = 0;
|
long MaxModSize = 0;
|
||||||
void LuaMain(std::string Path);
|
void LuaMain(std::string Path);
|
||||||
void HandleResources(std::string path){
|
void HandleResources(std::string path){
|
||||||
struct stat info{};
|
struct stat info{};
|
||||||
|
@ -14,7 +14,7 @@ extern std::string MapName;
|
|||||||
extern std::string Key;
|
extern std::string Key;
|
||||||
extern int MaxPlayers;
|
extern int MaxPlayers;
|
||||||
extern int ModsLoaded;
|
extern int ModsLoaded;
|
||||||
extern int MaxModSize;
|
extern long MaxModSize;
|
||||||
extern bool Private;
|
extern bool Private;
|
||||||
extern int MaxCars;
|
extern int MaxCars;
|
||||||
extern bool Debug;
|
extern bool Debug;
|
||||||
|
@ -15,8 +15,8 @@ void ParseConfig();
|
|||||||
void addToLog(const std::string& Data);
|
void addToLog(const std::string& Data);
|
||||||
//void ServerMain(int Port, int MaxClients);
|
//void ServerMain(int Port, int MaxClients);
|
||||||
void HeartbeatInit();
|
void HeartbeatInit();
|
||||||
std::string ServerVersion = "0.43";
|
std::string ServerVersion = "0.45";
|
||||||
std::string ClientVersion = "1.43";
|
std::string ClientVersion = "1.46";
|
||||||
std::string CustomIP;
|
std::string CustomIP;
|
||||||
void HandleResources(std::string path);
|
void HandleResources(std::string path);
|
||||||
void StatInit();
|
void StatInit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user