Commit 39c1873d072d40e8c38712562ee2961c40f4d1ab
1 parent
80cad8fe
Deal with empty session for early client disconnect
Showing
2 changed files
with
4 additions
and
1 deletions
client.cpp
| @@ -69,7 +69,7 @@ Client::~Client() | @@ -69,7 +69,7 @@ Client::~Client() | ||
| 69 | close(fd); | 69 | close(fd); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | - if (session->getDestroyOnDisconnect()) | 72 | + if (session && session->getDestroyOnDisconnect()) |
| 73 | { | 73 | { |
| 74 | store->removeSession(session); | 74 | store->removeSession(session); |
| 75 | } | 75 | } |
subscriptionstore.cpp
| @@ -634,6 +634,9 @@ void SubscriptionStore::removeExpiredSessionsClients() | @@ -634,6 +634,9 @@ void SubscriptionStore::removeExpiredSessionsClients() | ||
| 634 | 634 | ||
| 635 | void SubscriptionStore::queueSessionRemoval(const std::shared_ptr<Session> &session) | 635 | void SubscriptionStore::queueSessionRemoval(const std::shared_ptr<Session> &session) |
| 636 | { | 636 | { |
| 637 | + if (!session) | ||
| 638 | + return; | ||
| 639 | + | ||
| 637 | QueuedSessionRemoval qsr(session); | 640 | QueuedSessionRemoval qsr(session); |
| 638 | 641 | ||
| 639 | auto comp = [](const QueuedSessionRemoval &a, const QueuedSessionRemoval &b) | 642 | auto comp = [](const QueuedSessionRemoval &a, const QueuedSessionRemoval &b) |