← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3353: avoid a potential bottleneck

 

------------------------------------------------------------
revno: 3353
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2013-09-22 15:51:20 +0200
message:
  avoid a potential bottleneck
modified:
  Compile.txt
  changelog.txt
  dcpp/ClientManager.cpp
  dcpp/ConnectionManager.cpp
  dcpp/ConnectionManager.h


--
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 'Compile.txt'
--- Compile.txt	2013-08-08 18:04:01 +0000
+++ Compile.txt	2013-09-22 13:51:20 +0000
@@ -6,9 +6,9 @@
 		Some tools can be found on <http://sourceforge.net/projects/dcplusplus/files/Dev/>,
 		although I recommend getting them directly from their hosts.
 
-		* A modern C++ compiler. I am currently using these 2 packages by the MinGW-builds project:
-		- 64-bit: <http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-win32/seh/>
-		- 32-bit: <http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-win32/dwarf/>
+		* A modern C++ compiler. I am currently using these 2 packages by the MinGW-w64 project:
+		- 64-bit: <http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.8.1/threads-win32/seh/>
+		- 32-bit: <http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.1/threads-win32/dwarf/>
 
 		Make sure that the compiler's "bin" directory is in your PATH environment variable.
 
@@ -110,7 +110,6 @@
 4. Alternative compilers
 
 	a. Various versions of MinGW (GCC 4.8 or later):
-	<http://sourceforge.net/projects/mingwbuilds/files/>
 	<http://sourceforge.net/projects/mingw-w64/files/>
 	<http://sourceforge.net/projects/mingw/files/>
 
@@ -119,9 +118,9 @@
 		Prefer DWARF versions (usually marked with a "-dw") of 32-bit compilers; SJLJ ones should
 		be avoided for performance reasons.
 
-		I am currently using these 2 packages by the MinGW-builds project:
-		- 32-bit: <http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-win32/dwarf/>
-		- 64-bit: <http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-win32/seh/>
+		I am currently using these 2 packages by the MinGW-w64 project:
+		- 64-bit: <http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.8.1/threads-win32/seh/>
+		- 32-bit: <http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.1/threads-win32/dwarf/>
 
 		To install compilers from regular MinGW (not MinGW-w64), the easiest way is to use
 		mingw-get. Extract it to C:\MinGW and run:
@@ -199,8 +198,7 @@
 
 		f. Developing plugins
 
-			See <https://launchpad.net/dcpp-plugin-sdk-c> and
-			<https://launchpad.net/dcpp-plugin-sdk-cpp> for C and C++ plugin SDKs.
+			The DC plugin SDK is at <https://launchpad.net/dc-plugin-sdk>.
 
 			See dcpp/Plugin* files for implementation details.
 

=== modified file 'changelog.txt'
--- changelog.txt	2013-09-16 18:41:22 +0000
+++ changelog.txt	2013-09-22 13:51:20 +0000
@@ -12,6 +12,7 @@
 * [ADC] Send FM / FB in code 43 STAs instead of FL (poy)
 * Don't reconnect after a manual hub disconnect (poy)
 * [L#1225930] Always show the window when double-clicking the notif icon (poy)
+* [L#1220488] Upgrade the compiler
 
 -- 0.828 2013-07-23 --
 * Translation fixes

=== modified file 'dcpp/ClientManager.cpp'
--- dcpp/ClientManager.cpp	2013-09-15 16:39:42 +0000
+++ dcpp/ClientManager.cpp	2013-09-22 13:51:20 +0000
@@ -302,7 +302,7 @@
 UserPtr ClientManager::findUser(const CID& cid) const noexcept {
 	Lock l(cs);
 	auto ui = users.find(cid);
-	return ui == users.end() ? 0 : ui->second;
+	return ui == users.end() ? nullptr : ui->second;
 }
 
 bool ClientManager::isOp(const UserPtr& user, const string& aHubUrl) const {

=== modified file 'dcpp/ConnectionManager.cpp'
--- dcpp/ConnectionManager.cpp	2013-09-16 18:23:35 +0000
+++ dcpp/ConnectionManager.cpp	2013-09-22 13:51:20 +0000
@@ -36,7 +36,6 @@
 	floodCounter(0),
 	shuttingDown(false)
 {
-	ClientManager::getInstance()->addListener(this);
 	TimerManager::getInstance()->addListener(this);
 
 	features.push_back(UserConnection::FEATURE_MINISLOTS);
@@ -234,6 +233,17 @@
 void ConnectionManager::on(TimerManagerListener::Minute, uint64_t aTick) noexcept {
 	Lock l(cs);
 
+	// remove tokens associated with offline users.
+	for(auto i = tokens.begin(); i != tokens.end();) {
+		auto user = ClientManager::getInstance()->findUser(i->second.first);
+		if(user && user->isOnline()) {
+			++i;
+		} else {
+			i = tokens.erase(i);
+		}
+	}
+
+	// disconnect connections that have timed out.
 	for(auto& j: userConnections) {
 		if((j->getLastActivity() + 180*1000) < aTick) {
 			j->disconnect(true);
@@ -860,7 +870,6 @@
 }
 
 void ConnectionManager::shutdown() {
-	ClientManager::getInstance()->removeListener(this);
 	TimerManager::getInstance()->removeListener(this);
 
 	shuttingDown = true;
@@ -883,19 +892,6 @@
 	}
 }
 
-// ClientManagerListener
-void ConnectionManager::on(ClientManagerListener::UserDisconnected, const UserPtr& user) noexcept {
-	// remove tokens associated with the user.
-	Lock l(cs);
-	for(auto i = tokens.begin(); i != tokens.end();) {
-		if(i->second.first == user->getCID()) {
-			i = tokens.erase(i);
-		} else {
-			++i;
-		}
-	}
-}
-
 // UserConnectionListener
 void ConnectionManager::on(UserConnectionListener::Supports, UserConnection* conn, const StringList& feat) noexcept {
 	for(auto& i: feat) {

=== modified file 'dcpp/ConnectionManager.h'
--- dcpp/ConnectionManager.h	2013-09-15 16:39:42 +0000
+++ dcpp/ConnectionManager.h	2013-09-22 13:51:20 +0000
@@ -24,7 +24,6 @@
 #include <vector>
 
 #include "BufferedSocket.h"
-#include "ClientManagerListener.h"
 #include "ConnectionManagerListener.h"
 #include "ConnectionType.h"
 #include "CriticalSection.h"
@@ -98,7 +97,6 @@
 class ConnectionManager :
 	public Singleton<ConnectionManager>,
 	public Speaker<ConnectionManagerListener>,
-	private ClientManagerListener,
 	private TimerManagerListener,
 	private UserConnectionListener
 {
@@ -194,9 +192,6 @@
 
 	void failed(UserConnection* aSource, const string& aError, bool protocolError);
 
-	// ClientManagerListener
-	virtual void on(ClientManagerListener::UserDisconnected, const UserPtr& user) noexcept;
-
 	// UserConnectionListener
 	virtual void on(Connected, UserConnection*) noexcept;
 	virtual void on(Failed, UserConnection*, const string&) noexcept;