mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Disconnect before deleting the session
The session was deleted from `m_Sessions` before disconnecting. Since
e7a583adc0 that also deleted the session.
This commit is contained in:
parent
a95579a046
commit
34ab0f3938
1 changed files with 4 additions and 5 deletions
|
|
@ -496,14 +496,13 @@ bool CNetServerWorker::RunStep()
|
|||
|
||||
// Remove the session first, so we won't send player-update messages to it
|
||||
// when updating the FSM
|
||||
std::erase_if(m_Sessions, [&](const auto& s)
|
||||
{
|
||||
return s.get() == session;
|
||||
});
|
||||
const auto iter = std::ranges::find(m_Sessions, session,
|
||||
&std::unique_ptr<CNetServerSession>::get);
|
||||
const std::unique_ptr<CNetServerSession> _ = std::move(*iter);
|
||||
m_Sessions.erase(iter);
|
||||
|
||||
session->Update((uint)NMT_CONNECTION_LOST, NULL);
|
||||
|
||||
delete session;
|
||||
event.peer->data = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue