Fixed double deletetion of User class when there's connection error
This commit is contained in:
parent
34207065ce
commit
d969b37743
2 changed files with 11 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
|||
[service]
|
||||
admin_username=admin
|
||||
admin_password=test
|
||||
admin_username=admin_
|
||||
admin_password=test_
|
||||
|
||||
[servers]
|
||||
server=localhost
|
||||
server=icq.spectrum.im
|
||||
#server=localhost
|
||||
server=icq.spectrum.im
|
||||
server=msn.spectrum.im
|
|
@ -158,11 +158,15 @@ void User::handleDisconnected(const std::string &error) {
|
|||
msg->setFrom(m_component->getJID());
|
||||
m_component->getStanzaChannel()->sendMessage(msg);
|
||||
|
||||
// In server mode, server finishes the session and pass unavailable session to userManager,
|
||||
// so we can't removeUser() in server mode, because it would be removed twice.
|
||||
// Once in finishSession and once in m_userManager->removeUser.
|
||||
if (m_component->inServerMode()) {
|
||||
dynamic_cast<Swift::ServerStanzaChannel *>(m_component->getStanzaChannel())->finishSession(m_jid, boost::shared_ptr<Swift::Element>(new Swift::StreamError()));
|
||||
}
|
||||
|
||||
m_userManager->removeUser(this);
|
||||
else {
|
||||
m_userManager->removeUser(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue