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