From 402166fb8945dd8c591f1f9676683e3ce768fb2e Mon Sep 17 00:00:00 2001 From: upstream svn Date: Tue, 8 Mar 2011 09:51:01 +0000 Subject: [PATCH] Add a setting to disable EC transmission of clients (except clients uploaded to) Poor CPUs are getting problems with the client transmission (or rather the gathering of the data for it). When ExternalConnect/TransmitOnlyUploadingClients is set to 1 only uploads will be shown in amulegui. See http://forum.amule.org/index.php?topic=17343.msg101528#msg101528 --- .svn-revision | 2 +- src/ExternalConn.cpp | 6 ++++++ src/Preferences.cpp | 3 +++ src/Preferences.h | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.svn-revision b/.svn-revision index a9557cd3..fc14c60e 100644 --- a/.svn-revision +++ b/.svn-revision @@ -1 +1 @@ -10476 +10477 diff --git a/src/ExternalConn.cpp b/src/ExternalConn.cpp index b69dc45d..e6d17a85 100644 --- a/src/ExternalConn.cpp +++ b/src/ExternalConn.cpp @@ -671,8 +671,14 @@ static CECPacket *Get_EC_Response_GetUpdate(CFileEncoderMap &encoders, CObjTagMa // Add clients CECEmptyTag clients(EC_TAG_CLIENT); const CClientList::IDMap& clientList = theApp->clientlist->GetClientList(); + bool onlyTransmittingClients = thePrefs::IsTransmitOnlyUploadingClients(); for (CClientList::IDMap::const_iterator it = clientList.begin(); it != clientList.end(); it++) { const CUpDownClient* cur_client = it->second.GetClient(); + if (onlyTransmittingClients && !cur_client->IsDownloading()) { + // For poor CPU cores only transmit uploading clients. This will save a lot of CPU. + // Set ExternalConnect/TransmitOnlyUploadingClients to 1 for it. + continue; + } CValueMap &valuemap = tagmap.GetValueMap(cur_client->ECID()); clients.AddTag(CEC_UpDownClient_Tag(cur_client, EC_DETAIL_INC_UPDATE, &valuemap)); } diff --git a/src/Preferences.cpp b/src/Preferences.cpp index 01f12e83..9a7436e0 100644 --- a/src/Preferences.cpp +++ b/src/Preferences.cpp @@ -180,6 +180,7 @@ bool CPreferences::s_AcceptExternalConnections; wxString CPreferences::s_ECAddr; uint32 CPreferences::s_ECPort; wxString CPreferences::s_ECPassword; +bool CPreferences::s_TransmitOnlyUploadingClients; bool CPreferences::s_IPFilterClients; bool CPreferences::s_IPFilterServers; bool CPreferences::s_UseSrcSeeds; @@ -1290,6 +1291,8 @@ void CPreferences::BuildItemList( const wxString& appdir ) s_MiscList.push_back( new Cfg_Str( wxT("/eMule/StatsServerName"), s_StatsServerName, wxT("Shorty's ED2K stats") ) ); s_MiscList.push_back( new Cfg_Str( wxT("/eMule/StatsServerURL"), s_StatsServerURL, wxT("http://ed2k.shortypower.dyndns.org/?hash=") ) ); + s_MiscList.push_back( new Cfg_Bool( wxT("/ExternalConnect/TransmitOnlyUploadingClients"), s_TransmitOnlyUploadingClients, false ) ); + #ifndef AMULE_DAEMON // Colors have been moved from global prefs to CStatisticsDlg for ( int i = 0; i < cntStatColors; i++ ) { diff --git a/src/Preferences.h b/src/Preferences.h index d54687c2..2a77895e 100644 --- a/src/Preferences.h +++ b/src/Preferences.h @@ -429,6 +429,8 @@ public: static void SetECPort(uint32 val) { s_ECPort = val; } static const wxString& ECPassword() { return s_ECPassword; } static void SetECPass(const wxString& pass) { s_ECPassword = pass; } + static bool IsTransmitOnlyUploadingClients() { return s_TransmitOnlyUploadingClients; } + // Fast ED2K Links Handler Toggling static bool GetFED2KLH() { return s_FastED2KLinksHandler; } @@ -728,6 +730,7 @@ protected: static wxString s_ECAddr; static uint32 s_ECPort; static wxString s_ECPassword; + static bool s_TransmitOnlyUploadingClients; // Kry - IPFilter static bool s_IPFilterClients; -- 2.11.4.GIT