mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-06-17 22:23:03 +00:00
minor bug fix
This commit is contained in:
@@ -11,13 +11,14 @@
|
|||||||
|
|
||||||
void GrabRole(Client*c);
|
void GrabRole(Client*c);
|
||||||
|
|
||||||
void STCPSend(Client*c,const std::any& Data,size_t Size){
|
void STCPSend(Client*c,std::any Data,size_t Size){
|
||||||
char *MSG;
|
int BytesSent;
|
||||||
if(std::string(Data.type().name()).find("string") != std::string::npos){
|
if(std::string(Data.type().name()).find("string") != std::string::npos){
|
||||||
MSG = (char*)(std::any_cast<std::string>(Data).c_str());
|
std::string data = std::any_cast<std::string>(Data);
|
||||||
}else MSG = std::any_cast<char*>(Data);
|
BytesSent = send(c->GetTCPSock(), data.c_str(), data.size(), 0);
|
||||||
if(Size == 0)Size = strlen(MSG)+1;
|
}else{
|
||||||
int BytesSent = send(c->GetTCPSock(), MSG, Size, 0);
|
BytesSent = send(c->GetTCPSock(), std::any_cast<char*>(Data), Size, 0);
|
||||||
|
}
|
||||||
if (BytesSent == 0){
|
if (BytesSent == 0){
|
||||||
std::cout << "(TCP) Connection closing..." << std::endl;
|
std::cout << "(TCP) Connection closing..." << std::endl;
|
||||||
if(c->GetStatus() > -1)c->SetStatus(-1);
|
if(c->GetStatus() > -1)c->SetStatus(-1);
|
||||||
@@ -76,7 +77,7 @@ void Parse(Client*c,char*data){
|
|||||||
case 'S':
|
case 'S':
|
||||||
if(SubCode == 'R'){
|
if(SubCode == 'R'){
|
||||||
std::cout << "Sending File Info" << std::endl;
|
std::cout << "Sending File Info" << std::endl;
|
||||||
STCPSend(c,FileList+FileSizes,0);
|
STCPSend(c,std::string(FileList+FileSizes),0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 'N':
|
case 'N':
|
||||||
|
|||||||
Reference in New Issue
Block a user