linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04618
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2634: Fix shutdown crash
------------------------------------------------------------
revno: 2634
fixes bug: https://launchpad.net/bugs/868203
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Thu 2011-10-13 11:26:17 +0900
message:
Fix shutdown crash
modified:
dcpp/Client.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 'dcpp/Client.cpp'
--- dcpp/Client.cpp 2011-09-30 11:33:12 +0000
+++ dcpp/Client.cpp 2011-10-13 02:26:17 +0000
@@ -38,14 +38,7 @@
{
string file, proto, query, fragment;
Util::decodeUrl(hubURL, proto, address, port, file, query, fragment);
-
- if(!query.empty()) {
- auto q = Util::decodeQuery(query);
- auto kp = q.find("kp");
- if(kp != q.end()) {
- keyprint = kp->second;
- }
- }
+ keyprint = Util::decodeQuery(query)["kp"];
TimerManager::getInstance()->addListener(this);
}
@@ -92,8 +85,7 @@
}
void Client::connect() {
- if(sock)
- sock.reset();
+ sock.reset();
setAutoReconnect(true);
setReconnDelay(120 + Util::rand(0, 60));
@@ -109,8 +101,8 @@
sock->addListener(this);
sock->connect(address, port, secure, BOOLSETTING(ALLOW_UNTRUSTED_HUBS), true);
} catch(const Exception& e) {
- shutdown();
- /// @todo at this point, this hub instance is completely useless
+ sock.reset();
+ state = STATE_DISCONNECTED;
fire(ClientListener::Failed(), this, e.getError());
}
updateActivity();
@@ -151,7 +143,6 @@
void Client::on(Failed, const string& aLine) noexcept {
state = STATE_DISCONNECTED;
FavoriteManager::getInstance()->removeUserCommand(getHubUrl());
- sock->removeListener(this);
fire(ClientListener::Failed(), this, aLine);
}