Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -u orig/ClientManager.cpp air/ClientManager.cpp
- --- orig/ClientManager.cpp 2012-04-17 20:47:29.465714900 +0200
- +++ air/ClientManager.cpp 2012-04-17 21:11:34.494365800 +0200
- @@ -582,21 +582,22 @@
- }
- }
- -void ClientManager::search(StringList& who, int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken, const StringList& aExtList) {
- +void ClientManager::search(string& who, int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken, const StringList& aExtList) {
- Lock l(cs);
- - auto i = clients.find(const_cast<string*>(&who));
- - if(i != clients.end() && i->second->isConnected()) {
- - return i->second->search(aSizeMode, aSize, aFileType, aString, aToken, aExtList);
- + for(auto i = clients.begin(); i != clients.end(); ++i) { //change clients set to map<string*(hubUrl), Client*> for better lookup with .find
- + if(((*i)->getHubUrl() == who) && (*i)->isConnected()) {
- + (*i)->search(aSizeMode, aSize, aFileType, aString, aToken, aExtList);
- + break;
- + }
- }
- - return 0;
- }
- void ClientManager::getOnlineClients(StringList& onlineClients) {
- Lock l (cs);
- - for_each(clients, [&](pair<string*, Client*> cp) {
- - if (cp.second->isConnected())
- - onlineClients.push_back(cp.second->getHubUrl());
- - });
- + for(auto i = clients.begin(); i != clients.end(); ++i) {
- + if((*i)->isConnected())
- + onlineClients.push_back((*i)->getHubUrl());
- + }
- }
- void ClientManager::on(TimerManagerListener::Minute, uint64_t /* aTick */) noexcept {
- diff -u orig/ClientManager.h air/ClientManager.h
- --- orig/ClientManager.h 2012-04-17 20:45:33.924106300 +0200
- +++ air/ClientManager.h 2012-04-17 20:55:55.273645500 +0200
- @@ -88,7 +88,7 @@
- bool isConnected(const string& aUrl) const;
- void search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken);
- - void search(StringList& who, int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken, const StringList& aExtList);
- + void search(string& who, int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken, const StringList& aExtList);
- void infoUpdated();
- UserPtr getUser(const string& aNick, const string& aHubUrl) noexcept;
- diff -u orig/ConnectionManager.cpp air/ConnectionManager.cpp
- --- orig/ConnectionManager.cpp 2012-04-14 15:42:56.094440200 +0200
- +++ air/ConnectionManager.cpp 2012-04-14 15:44:01.422176800 +0200
- @@ -70,7 +70,7 @@
- if(i == downloads.end()) {
- getCQI(aUser, true);
- } else {
- - DownloadManager::getInstance()->checkIdle(aUser.user);
- + DownloadManager::getInstance()->checkIdle(aUser);
- }
- }
- }
- diff -u orig/Download.cpp air/Download.cpp
- --- orig/Download.cpp 2012-04-14 15:30:01.953161900 +0200
- +++ air/Download.cpp 2012-04-14 15:33:53.029378700 +0200
- @@ -64,7 +64,7 @@
- getUserConnection().setDownload(0);
- }
- -AdcCommand Download::getCommand(bool zlib, bool enabler) {
- +AdcCommand Download::getCommand(bool zlib, const string& mySID, bool enabler) {
- AdcCommand cmd(AdcCommand::CMD_GET);
- if(enabler) {
- diff -u orig/Download.h air/Download.h
- --- orig/Download.h 2012-04-14 14:47:57.618000000 +0200
- +++ air/Download.h 2012-04-14 15:34:32.469634500 +0200
- @@ -67,7 +67,7 @@
- TigerTree& getTigerTree() { return tt; }
- const string& getPFS() const { return pfs; }
- /** @internal */
- - AdcCommand getCommand(bool zlib, bool enable = false);
- + AdcCommand getCommand(bool zlib, const string& mySID, bool enable = false);
- const unique_ptr<OutputStream>& getOutput() const { return output; }
- diff -u orig/DownloadManager.cpp air/DownloadManager.cpp
- --- orig/DownloadManager.cpp 2012-04-14 15:32:39.412168000 +0200
- +++ air/DownloadManager.cpp 2012-04-17 19:55:45.164159000 +0200
- @@ -20,6 +20,7 @@
- #include "DownloadManager.h"
- #include "QueueManager.h"
- +#include "ClientManager.h"
- #include "Download.h"
- #include "LogManager.h"
- #include "User.h"
- @@ -105,11 +106,13 @@
- }
- }
- -void DownloadManager::checkIdle(const UserPtr& user) {
- +void DownloadManager::checkIdle(const HintedUser& user) {
- Lock l(cs);
- for(auto i = idlers.begin(); i != idlers.end(); ++i) {
- UserConnection* uc = *i;
- - if(uc->getUser() == user) {
- + if(uc->getUser() == user.user) {
- + if(Util::stricmp(uc->getHubUrl(), user.hint) != 0)
- + uc->setHubUrl(user.hint);
- uc->updated();
- return;
- }
- diff -u orig/DownloadManager.h air/DownloadManager.h
- --- orig/DownloadManager.h 2012-04-14 14:47:57.618000000 +0200
- +++ air/DownloadManager.h 2012-04-14 15:40:10.024941600 +0200
- @@ -43,7 +43,7 @@
- /** @internal */
- void addConnection(UserConnectionPtr conn);
- - void checkIdle(const UserPtr& user);
- + void checkIdle(const HintedUser& user);
- /** @return Running average download speed in Bytes/s */
- int64_t getRunningAverage();
- diff -u orig/SearchManager.cpp air/SearchManager.cpp
- --- orig/SearchManager.cpp 2012-04-17 21:28:40.646058400 +0200
- +++ air/SearchManager.cpp 2012-04-18 19:21:12.111384500 +0200
- @@ -340,8 +340,8 @@
- Lock l (cs);
- auto i = searches.find(token);
- if (i != searches.end()) {
- - localToken = get<LOCALTOKEN>((*i).second);
- - hub = get<HUBURL>((*i).second);
- + localToken = boost::get<LOCALTOKEN>((*i).second);
- + hub = boost::get<HUBURL>((*i).second);
- }
- }
- SearchResult::Types type = (file[file.length() - 1] == '\\' ? SearchResult::TYPE_DIRECTORY : SearchResult::TYPE_FILE);
- @@ -349,7 +349,7 @@
- return;
- /// @todo Something about the slots
- SearchResultPtr sr(new SearchResult(from, type, 0, freeSlots, size,
- - file, hubName, hub, remoteIp, TTHValue(tth), token));
- + file, hubName, hub, remoteIp, TTHValue(tth), localToken));
- fire(SearchManagerListener::SR(), sr);
- }
- }
- diff -u orig/SearchManager.h air/SearchManager.h
- --- orig/SearchManager.h 2012-04-17 21:16:24.370945800 +0200
- +++ air/SearchManager.h 2012-04-17 21:16:28.241167200 +0200
- @@ -106,6 +106,7 @@
- uint64_t lastSearch;
- friend class Singleton<SearchManager>;
- CriticalSection cs;
- +
- SearchManager();
- static std::string normalizeWhitespace(const std::string& aString);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement