mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-04 00:36:14 +00:00
Clear the queue if we failed to sync it
This commit is contained in:
parent
ca24339c9a
commit
7ccc5a963a
@ -361,6 +361,12 @@ bool TNetwork::TCPSend(TClient& c, const std::string& Data, bool IsSync) {
|
|||||||
if (!TCPSend(c, QData, true)) {
|
if (!TCPSend(c, QData, true)) {
|
||||||
if (c.GetStatus() > -1)
|
if (c.GetStatus() > -1)
|
||||||
c.SetStatus(-1);
|
c.SetStatus(-1);
|
||||||
|
{
|
||||||
|
std::unique_lock lock(c.MissedPacketQueueMutex());
|
||||||
|
while(!c.MissedPacketQueue().empty()){
|
||||||
|
c.MissedPacketQueue().pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
CloseSocketProper(c.GetTCPSock());
|
CloseSocketProper(c.GetTCPSock());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -382,7 +388,7 @@ bool TNetwork::TCPSend(TClient& c, const std::string& Data, bool IsSync) {
|
|||||||
c.SetStatus(-1);
|
c.SetStatus(-1);
|
||||||
return false;
|
return false;
|
||||||
} else if (Temp < 0) {
|
} else if (Temp < 0) {
|
||||||
debug("send() < 0: " + std::string(std::strerror(errno)));
|
debug("send() < 0: " + std::string(std::strerror(errno))); //TODO fix it was spamming yet everyone stayed on the server
|
||||||
if (c.GetStatus() > -1)
|
if (c.GetStatus() > -1)
|
||||||
c.SetStatus(-1);
|
c.SetStatus(-1);
|
||||||
CloseSocketProper(c.GetTCPSock());
|
CloseSocketProper(c.GetTCPSock());
|
||||||
|
@ -304,6 +304,6 @@ void TServer::Apply(TClient& c, int VID, const std::string& pckt) {
|
|||||||
|
|
||||||
void TServer::InsertClient(const std::shared_ptr<TClient>& NewClient) {
|
void TServer::InsertClient(const std::shared_ptr<TClient>& NewClient) {
|
||||||
debug("inserting client (" + std::to_string(ClientCount()) + ")");
|
debug("inserting client (" + std::to_string(ClientCount()) + ")");
|
||||||
WriteLock Lock(mClientsMutex);
|
WriteLock Lock(mClientsMutex); //TODO why is there 30+ threads locked here
|
||||||
(void)mClients.insert(NewClient);
|
(void)mClients.insert(NewClient);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user