linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04985
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2735: Fix removal of same ADC users logged into multiple hubs when they go offline
------------------------------------------------------------
revno: 2735
committer: eMTee <emtee11@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Mon 2011-12-19 21:49:15 +0100
message:
Fix removal of same ADC users logged into multiple hubs when they go offline
modified:
changelog.txt
dcpp/ClientManager.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2011-12-18 13:41:12 +0000
+++ changelog.txt 2011-12-19 20:49:15 +0000
@@ -53,6 +53,8 @@
* Add user matching settings (poy)
* [L#887021] No beep on ctrl+A in some text-boxes (poy)
* Improve list filters, add one to filter search results (poy)
+* [L#901237] Fix a possible crash on parital list removal from the queue (thanks bigmuscle)
+* [L#900650] Fix removal of same ADC users logged into multiple hubs when they go offline (emtee)
-- 0.782 2011-03-05 --
* Prevent a remote crash triggered via malformed user commands (poy)
=== modified file 'dcpp/ClientManager.cpp'
--- dcpp/ClientManager.cpp 2011-12-03 21:53:57 +0000
+++ dcpp/ClientManager.cpp 2011-12-19 20:49:15 +0000
@@ -356,7 +356,7 @@
}
void ClientManager::putOffline(OnlineUser* ou, bool disconnect) noexcept {
- bool lastUser = false;
+ OnlineIter::difference_type diff = 0;
{
Lock l(cs);
OnlinePair op = onlineUsers.equal_range(ou->getUser()->getCID());
@@ -364,19 +364,21 @@
for(OnlineIter i = op.first; i != op.second; ++i) {
OnlineUser* ou2 = i->second;
if(ou == ou2) {
- lastUser = (distance(op.first, op.second) == 1);
+ diff = distance(op.first, op.second);
onlineUsers.erase(i);
break;
}
}
}
- if(lastUser) {
+ if(diff == 1) { //last user
UserPtr& u = ou->getUser();
u->unsetFlag(User::ONLINE);
if(disconnect)
ConnectionManager::getInstance()->disconnect(u);
fire(ClientManagerListener::UserDisconnected(), u);
+ } else if(diff > 1) {
+ fire(ClientManagerListener::UserUpdated(), *ou);
}
}