diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 2a99db3ebc4c211e436f95fde24b5ac6826d0267 (patch) | |
tree | ce2e122a017c12f803ea428a299c7e3cec52c8fe /libktorrent/kademlia | |
parent | 100dcb6968ca22bfa52836ad55eb4f01225791db (diff) | |
download | ktorrent-2a99db3ebc4c211e436f95fde24b5ac6826d0267.tar.gz ktorrent-2a99db3ebc4c211e436f95fde24b5ac6826d0267.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libktorrent/kademlia')
-rw-r--r-- | libktorrent/kademlia/announcetask.cpp | 8 | ||||
-rw-r--r-- | libktorrent/kademlia/database.cpp | 12 | ||||
-rw-r--r-- | libktorrent/kademlia/database.h | 2 | ||||
-rw-r--r-- | libktorrent/kademlia/dht.cpp | 2 | ||||
-rw-r--r-- | libktorrent/kademlia/kbucket.cpp | 10 | ||||
-rw-r--r-- | libktorrent/kademlia/kbucket.h | 2 | ||||
-rw-r--r-- | libktorrent/kademlia/node.h | 2 | ||||
-rw-r--r-- | libktorrent/kademlia/nodelookup.cpp | 4 | ||||
-rw-r--r-- | libktorrent/kademlia/rpcserver.cpp | 12 |
9 files changed, 27 insertions, 27 deletions
diff --git a/libktorrent/kademlia/announcetask.cpp b/libktorrent/kademlia/announcetask.cpp index 5e5b925..95f4020 100644 --- a/libktorrent/kademlia/announcetask.cpp +++ b/libktorrent/kademlia/announcetask.cpp @@ -58,7 +58,7 @@ namespace dht { // add node to todo list KBucketEntry e = UnpackBucketEntry(n,i*26); - if (!todo.tqcontains(e) && !visited.tqcontains(e) && + if (!todo.contains(e) && !visited.contains(e) && todo.count() < 100) { todo.append(e); @@ -78,7 +78,7 @@ namespace dht // add the peer who responded to the answered list, so we can do an announce KBucketEntry e(rsp->getOrigin(),rsp->getID()); - if (!answered.tqcontains(KBucketEntryAndToken(e,gpr->getToken())) && !answered_visited.tqcontains(e)) + if (!answered.contains(KBucketEntryAndToken(e,gpr->getToken())) && !answered_visited.contains(e)) { answered.append(KBucketEntryAndToken(e,gpr->getToken())); } @@ -101,7 +101,7 @@ namespace dht while (!answered.empty() && canDoRequest()) { KBucketEntryAndToken & e = answered.first(); - if (!answered_visited.tqcontains(e)) + if (!answered_visited.contains(e)) { AnnounceReq* anr = new AnnounceReq(node->getOurID(),info_hash,port,e.getToken()); anr->setOrigin(e.getAddress()); @@ -117,7 +117,7 @@ namespace dht { KBucketEntry e = todo.first(); // onLy send a findNode if we haven't allrready visited the node - if (!visited.tqcontains(e)) + if (!visited.contains(e)) { // send a findNode to the node GetPeersReq* gpr = new GetPeersReq(node->getOurID(),info_hash); diff --git a/libktorrent/kademlia/database.cpp b/libktorrent/kademlia/database.cpp index c4b34fd..447975f 100644 --- a/libktorrent/kademlia/database.cpp +++ b/libktorrent/kademlia/database.cpp @@ -72,7 +72,7 @@ namespace dht void Database::store(const dht::Key & key,const DBItem & dbi) { - DBItemList* dbl = items.tqfind(key); + DBItemList* dbl = items.find(key); if (!dbl) { dbl = new DBItemList(); @@ -83,7 +83,7 @@ namespace dht void Database::sample(const dht::Key & key,DBItemList & tdbl,bt::Uint32 max_entries) { - DBItemList* dbl = items.tqfind(key); + DBItemList* dbl = items.find(key); if (!dbl) return; @@ -144,7 +144,7 @@ namespace dht bool Database::checkToken(const dht::Key & token,Uint32 ip,Uint16 port) { // the token must be in the map - if (!tokens.tqcontains(token)) + if (!tokens.contains(token)) { Out(SYS_DHT|LOG_DEBUG) << "Unknown token" << endl; return false; @@ -169,14 +169,14 @@ namespace dht return true; } - bool Database::tqcontains(const dht::Key & key) const + bool Database::contains(const dht::Key & key) const { - return items.tqfind(key) != 0; + return items.find(key) != 0; } void Database::insert(const dht::Key & key) { - DBItemList* dbl = items.tqfind(key); + DBItemList* dbl = items.find(key); if (!dbl) { dbl = new DBItemList(); diff --git a/libktorrent/kademlia/database.h b/libktorrent/kademlia/database.h index 12e8373..365f6bb 100644 --- a/libktorrent/kademlia/database.h +++ b/libktorrent/kademlia/database.h @@ -118,7 +118,7 @@ namespace dht bool checkToken(const dht::Key & token,bt::Uint32 ip,bt::Uint16 port); /// Test wether or not the DB contains a key - bool tqcontains(const dht::Key & key) const; + bool contains(const dht::Key & key) const; /// Insert an empty item (only if it isn't already in the DB) void insert(const dht::Key & key); diff --git a/libktorrent/kademlia/dht.cpp b/libktorrent/kademlia/dht.cpp index 3eecd7c..f11c1cf 100644 --- a/libktorrent/kademlia/dht.cpp +++ b/libktorrent/kademlia/dht.cpp @@ -264,7 +264,7 @@ namespace dht AnnounceTask* at = new AnnounceTask(db,srv,node,info_hash,port); at->start(kns,!canStartTask()); tman->addTask(at); - if (!db->tqcontains(info_hash)) + if (!db->contains(info_hash)) db->insert(info_hash); return at; } diff --git a/libktorrent/kademlia/kbucket.cpp b/libktorrent/kademlia/kbucket.cpp index 76986b9..31148ba 100644 --- a/libktorrent/kademlia/kbucket.cpp +++ b/libktorrent/kademlia/kbucket.cpp @@ -119,7 +119,7 @@ namespace dht void KBucket::insert(const KBucketEntry & entry) { - TQValueList<KBucketEntry>::iterator i = entries.tqfind(entry); + TQValueList<KBucketEntry>::iterator i = entries.find(entry); // If in the list, move it to the end if (i != entries.end()) @@ -149,7 +149,7 @@ namespace dht { last_modified = bt::GetCurrentTime(); - if (!pending_entries_busy_pinging.tqcontains(c)) + if (!pending_entries_busy_pinging.contains(c)) return; KBucketEntry entry = pending_entries_busy_pinging[c]; @@ -166,7 +166,7 @@ namespace dht void KBucket::onTimeout(RPCCall* c) { - if (!pending_entries_busy_pinging.tqcontains(c)) + if (!pending_entries_busy_pinging.contains(c)) return; KBucketEntry entry = pending_entries_busy_pinging[c]; @@ -244,9 +244,9 @@ namespace dht return false; } - bool KBucket::tqcontains(const KBucketEntry & entry) const + bool KBucket::contains(const KBucketEntry & entry) const { - return entries.tqcontains(entry); + return entries.contains(entry); } void KBucket::findKClosestNodes(KClosestNodesSearch & kns) diff --git a/libktorrent/kademlia/kbucket.h b/libktorrent/kademlia/kbucket.h index cfd932d..6930c9d 100644 --- a/libktorrent/kademlia/kbucket.h +++ b/libktorrent/kademlia/kbucket.h @@ -169,7 +169,7 @@ namespace dht Uint32 getNumEntries() const {return entries.count();} /// See if this bucket contains an entry - bool tqcontains(const KBucketEntry & entry) const; + bool contains(const KBucketEntry & entry) const; /** * Find the K closest entries to a key and store them in the KClosestNodesSearch diff --git a/libktorrent/kademlia/node.h b/libktorrent/kademlia/node.h index 7d871e0..abc7782 100644 --- a/libktorrent/kademlia/node.h +++ b/libktorrent/kademlia/node.h @@ -37,7 +37,7 @@ namespace dht /** * @author Joris Guisson * - * A Node represents us in the kademlia network. It tqcontains + * A Node represents us in the kademlia network. It contains * our id and 160 KBucket's. * A KBucketEntry is in node i, when the difference between our id and * the KBucketEntry's id is between 2 to the power i and 2 to the power i+1. diff --git a/libktorrent/kademlia/nodelookup.cpp b/libktorrent/kademlia/nodelookup.cpp index 9175f7d..d1544b6 100644 --- a/libktorrent/kademlia/nodelookup.cpp +++ b/libktorrent/kademlia/nodelookup.cpp @@ -56,7 +56,7 @@ namespace dht // unpack an entry and add it to the todo list KBucketEntry e = UnpackBucketEntry(nodes,j*26); // lets not talk to ourself - if (e.getID() != node->getOurID() && !todo.tqcontains(e) && !visited.tqcontains(e)) + if (e.getID() != node->getOurID() && !todo.contains(e) && !visited.contains(e)) todo.append(e); } num_nodes_rsp++; @@ -78,7 +78,7 @@ namespace dht { KBucketEntry e = todo.first(); // only send a findNode if we haven't allrready visited the node - if (!visited.tqcontains(e)) + if (!visited.contains(e)) { // send a findNode to the node FindNodeReq* fnr = new FindNodeReq(node->getOurID(),node_id); diff --git a/libktorrent/kademlia/rpcserver.cpp b/libktorrent/kademlia/rpcserver.cpp index 9f65b95..0be22a8 100644 --- a/libktorrent/kademlia/rpcserver.cpp +++ b/libktorrent/kademlia/rpcserver.cpp @@ -134,10 +134,10 @@ namespace dht msg->setOrigin(pck.address()); msg->apply(dh_table); // erase an existing call - if (msg->getType() == RSP_MSG && calls.tqcontains(msg->getMTID())) + if (msg->getType() == RSP_MSG && calls.contains(msg->getMTID())) { // delete the call, but first notify it off the response - RPCCall* c = calls.tqfind(msg->getMTID()); + RPCCall* c = calls.find(msg->getMTID()); c->response(msg); calls.erase(msg->getMTID()); c->deleteLater(); @@ -165,7 +165,7 @@ namespace dht RPCCall* RPCServer::doCall(MsgBase* msg) { Uint8 start = next_mtid; - while (calls.tqcontains(next_mtid)) + while (calls.contains(next_mtid)) { next_mtid++; if (next_mtid == start) // if this happens we cannot do any calls @@ -197,7 +197,7 @@ namespace dht void RPCServer::timedOut(Uint8 mtid) { // delete the call - RPCCall* c = calls.tqfind(mtid); + RPCCall* c = calls.find(mtid); if (c) { dh_table->timeout(c->getRequest()); @@ -214,7 +214,7 @@ namespace dht RPCCall* c = call_queue.first(); call_queue.removeFirst(); - while (calls.tqcontains(next_mtid)) + while (calls.contains(next_mtid)) next_mtid++; MsgBase* msg = c->getRequest(); @@ -227,7 +227,7 @@ namespace dht const RPCCall* RPCServer::findCall(Uint8 mtid) const { - return calls.tqfind(mtid); + return calls.find(mtid); } void RPCServer::ping(const dht::Key & our_id,const KNetwork::KSocketAddress & addr) |