linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07239
[Bug 1194299] Re: Threading issues in hub management
it's only being called from 2 places guarded by isConnected so i think
it is safe... what do you think of the following patch?
=== modified file 'dcpp/Client.cpp'
--- dcpp/Client.cpp 2013-06-25 11:26:24 +0000
+++ dcpp/Client.cpp 2013-07-30 17:06:00 +0000
@@ -127,7 +127,9 @@
}
void Client::info() {
- sock->callAsync([this] { infoImpl(); });
+ if(isConnected()) {
+ sock->callAsync([this] { infoImpl(); });
+ }
}
void Client::send(const char* aMessage, size_t aLen) {
=== modified file 'dcpp/ClientManager.cpp'
--- dcpp/ClientManager.cpp 2013-06-25 16:04:21 +0000
+++ dcpp/ClientManager.cpp 2013-07-30 17:05:39 +0000
@@ -459,9 +459,7 @@
void ClientManager::infoUpdated() {
Lock l(cs);
for(auto i: clients) {
- if(i->isConnected()) {
- i->info();
- }
+ i->info();
}
}
@@ -551,9 +549,7 @@
}
for(auto j: clients) {
- if(j->isConnected()) {
- j->info();
- }
+ j->info();
}
}
--
You received this bug notification because you are a member of
Dcplusplus-team, which is subscribed to DC++.
https://bugs.launchpad.net/bugs/1194299
Title:
Threading issues in hub management
Status in DC++:
New
Bug description:
AdcHub::info is called from various different threads (timer, refresh,
hub, GUI) but it's not thread safe. lastInfoMap is unprotected while
it can be modified from different threads simultaneously. This has
been fixed in AirDC++ by syncing the info calls from other threads to
the hub thread.
Client::updateCounts is another function that shouldn't be called from
different threads because the hub counts may go wrong. This started to
cause real problems in AirDC++ when the info calls from TimerManager
were synced to the hub threads, which caused them to get executed
asynchronously all the time.
To manage notifications about this bug go to:
https://bugs.launchpad.net/dcplusplus/+bug/1194299/+subscriptions
References