Fixed the optional boolean in TCPSend

This commit is contained in:
Anonymous275
2021-02-28 15:47:42 +02:00
committed by Anonymous275
parent 7cd420a1a5
commit 3e2cb3176a
2 changed files with 9 additions and 9 deletions
+8 -8
View File
@@ -80,7 +80,7 @@ void TTCPServer::Authentication(SOCKET TCPSock) {
ClientKick(*Client, "Invalid version header!"); ClientKick(*Client, "Invalid version header!");
return; return;
} }
TCPSend(*Client, "S", false); TCPSend(*Client, "S");
Rc = TCPRcv(*Client); Rc = TCPRcv(*Client);
@@ -270,7 +270,7 @@ std::string TTCPServer::TCPRcv(TClient& c) {
void TTCPServer::ClientKick(TClient& c, const std::string& R) { void TTCPServer::ClientKick(TClient& c, const std::string& R) {
info("Client kicked: " + R); info("Client kicked: " + R);
TCPSend(c, "E" + R, false); TCPSend(c, "E" + R);
c.SetStatus(-2); c.SetStatus(-2);
CloseSocketProper(c.GetTCPSock()); CloseSocketProper(c.GetTCPSock());
} }
@@ -379,7 +379,7 @@ void TTCPServer::SyncResources(TClient& c) {
#ifndef DEBUG #ifndef DEBUG
try { try {
#endif #endif
TCPSend(c, "P" + std::to_string(c.GetID()), false); TCPSend(c, "P" + std::to_string(c.GetID()));
std::string Data; std::string Data;
while (c.GetStatus() > -1) { while (c.GetStatus() > -1) {
Data = TCPRcv(c); Data = TCPRcv(c);
@@ -411,7 +411,7 @@ void TTCPServer::Parse(TClient& c, const std::string& Packet) {
std::string ToSend = mResourceManager.FileList() + mResourceManager.FileSizes(); std::string ToSend = mResourceManager.FileList() + mResourceManager.FileSizes();
if (ToSend.empty()) if (ToSend.empty())
ToSend = "-"; ToSend = "-";
TCPSend(c, ToSend, false); TCPSend(c, ToSend);
} }
return; return;
default: default:
@@ -423,11 +423,11 @@ void TTCPServer::SendFile(TClient& c, const std::string& Name) {
info(c.GetName() + " requesting : " + Name.substr(Name.find_last_of('/'))); info(c.GetName() + " requesting : " + Name.substr(Name.find_last_of('/')));
if (!std::filesystem::exists(Name)) { if (!std::filesystem::exists(Name)) {
TCPSend(c, "CO", false); TCPSend(c, "CO");
warn("File " + Name + " could not be accessed!"); warn("File " + Name + " could not be accessed!");
return; return;
} else } else
TCPSend(c, "AG", false); TCPSend(c, "AG");
///Wait for connections ///Wait for connections
int T = 0; int T = 0;
@@ -520,7 +520,7 @@ void TTCPServer::SendLarge(TClient& c, std::string Data) {
std::string CMP(Comp(Data)); std::string CMP(Comp(Data));
Data = "ABG:" + CMP; Data = "ABG:" + CMP;
} }
TCPSend(c, Data, false); TCPSend(c, Data);
} }
void TTCPServer::Respond(TClient& c, const std::string& MSG, bool Rel) { void TTCPServer::Respond(TClient& c, const std::string& MSG, bool Rel) {
@@ -529,7 +529,7 @@ void TTCPServer::Respond(TClient& c, const std::string& MSG, bool Rel) {
if (C == 'O' || C == 'T' || MSG.length() > 1000) { if (C == 'O' || C == 'T' || MSG.length() > 1000) {
SendLarge(c, MSG); SendLarge(c, MSG);
} else { } else {
TCPSend(c, MSG, false); TCPSend(c, MSG);
} }
} else { } else {
UDPServer().UDPSend(c, MSG); UDPServer().UDPSend(c, MSG);
+1 -1
View File
@@ -102,7 +102,7 @@ void TUDPServer::SendToAll(TClient* c, const std::string& Data, bool Self, bool
if (C == 'O' || C == 'T' || Data.length() > 1000) if (C == 'O' || C == 'T' || Data.length() > 1000)
mTCPServer.SendLarge(*Client, Data); mTCPServer.SendLarge(*Client, Data);
else else
mTCPServer.TCPSend(*Client, Data, false); mTCPServer.TCPSend(*Client, Data);
} else } else
UDPSend(*Client, Data); UDPSend(*Client, Data);
} }