mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 23:35:41 +00:00
add more warning prints on unexpected cases
This commit is contained in:
parent
99f41c28cb
commit
f9251ff92c
@ -526,7 +526,7 @@ void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr) {
|
|||||||
try {
|
try {
|
||||||
LockedClientPtr = ClientPtr.lock();
|
LockedClientPtr = ClientPtr.lock();
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
// do nothing ig
|
beammp_warn("Client expired in OnDisconnect, this is unexpected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
beammp_assert(LockedClientPtr != nullptr);
|
beammp_assert(LockedClientPtr != nullptr);
|
||||||
@ -866,12 +866,13 @@ void TNetwork::SendToAll(TClient* c, const std::vector<uint8_t>& Data, bool Self
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
mServer.ForEachClient([&](std::weak_ptr<TClient> ClientPtr) -> bool {
|
mServer.ForEachClient([&](std::weak_ptr<TClient> ClientPtr) -> bool {
|
||||||
std::shared_ptr<TClient> Client;
|
std::shared_ptr<TClient> Client;
|
||||||
{
|
try {
|
||||||
ReadLock Lock(mServer.GetClientMutex());
|
ReadLock Lock(mServer.GetClientMutex());
|
||||||
if (!ClientPtr.expired()) {
|
Client = ClientPtr.lock();
|
||||||
Client = ClientPtr.lock();
|
} catch (const std::exception&) {
|
||||||
} else
|
// continue
|
||||||
return true;
|
beammp_warn("Client expired, shouldn't happen - if a client disconnected recently, you can ignore this");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (Self || Client.get() != c) {
|
if (Self || Client.get() != c) {
|
||||||
if (Client->IsSynced() || Client->IsSyncing()) {
|
if (Client->IsSynced() || Client->IsSyncing()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user