From c061bdd37ff91a4dd6f837f618fa2f48350e1ae6 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Thu, 11 Sep 2014 20:12:52 -0400 Subject: Fix locking bugs and make inventory deserialization errors more specific --- src/inventory.cpp | 2 +- src/server.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/inventory.cpp b/src/inventory.cpp index 4b1beb230..4766524dd 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -938,7 +938,7 @@ void Inventory::deSerialize(std::istream &is) } else { - throw SerializationError("invalid inventory specifier"); + throw SerializationError("invalid inventory specifier: " + name); } } } diff --git a/src/server.cpp b/src/server.cpp index fd9e1ce7b..262970c09 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1169,10 +1169,15 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id) std::string playername = ""; PlayerSAO *playersao = NULL; m_clients.Lock(); - RemoteClient* client = m_clients.lockedGetClientNoEx(peer_id, CS_InitDone); - if (client != NULL) { - playername = client->getName(); - playersao = emergePlayer(playername.c_str(), peer_id); + try { + RemoteClient* client = m_clients.lockedGetClientNoEx(peer_id, CS_InitDone); + if (client != NULL) { + playername = client->getName(); + playersao = emergePlayer(playername.c_str(), peer_id); + } + } catch (std::exception &e) { + m_clients.Unlock(); + throw; } m_clients.Unlock(); @@ -3869,7 +3874,7 @@ void Server::SendBlocks(float dtime) RemoteClient *client = m_clients.lockedGetClientNoEx(*i, CS_Active); if (client == NULL) - return; + continue; total_sending += client->SendingCount(); client->GetNextBlocks(m_env,m_emerge, dtime, queue); -- cgit v1.2.3