From 509266a25b9e7eec94da47ccc222dbcef5b18cef Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 7 Jun 2016 22:38:24 -0400 Subject: [PATCH] removed some dead code --- libretroshare/src/pqi/p3linkmgr.h | 2 +- libretroshare/src/pqi/pqihandler.cc | 138 ---------------------------- 2 files changed, 1 insertion(+), 139 deletions(-) diff --git a/libretroshare/src/pqi/p3linkmgr.h b/libretroshare/src/pqi/p3linkmgr.h index 926874b47..c7a551177 100644 --- a/libretroshare/src/pqi/p3linkmgr.h +++ b/libretroshare/src/pqi/p3linkmgr.h @@ -311,7 +311,7 @@ bool addAddressIfUnique(std::list &addrList, peerConnectAdd private: - // These should have there own Mutex Protection, + // These should have their own Mutex Protection, //p3tunnel *mP3tunnel; DNSResolver *mDNSResolver ; diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index 07e4ba582..e2c3006df 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -277,144 +277,6 @@ int pqihandler::SendRsRawItem(RsRawItem *ns) return queueOutRsItem(ns) ; } -#ifdef TO_BE_REMOVED - -// inputs. This is a very basic -// system that is completely biased and slow... -// someone please fix. - -///////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////// -// THIS CODE SHOULD BE ABLE TO BE REMOVED! -///////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////// - -int pqihandler::locked_GetItems() -{ - std::map::iterator it; - - RsItem *item; - int count = 0; - - // loop through modules.... - for(it = mods.begin(); it != mods.end(); ++it) - { - SearchModule *mod = (it -> second); - - // check security... is output allowed. - if(0 < secpolicy_check((it -> second) -> sp, - 0, PQI_INCOMING)) // PQI_ITEM_TYPE_ITEM, PQI_INCOMING)) - { - // if yes... attempt to read. - while((item = (mod -> pqi) -> GetItem()) != NULL) - { - - static int ntimes =0 ; -// if(++ntimes < 20) - { - std::cerr << "pqihandler::locked_GetItems() pqi->GetItem()"; - std::cerr << " should never happen anymore!"; - std::cerr << std::endl; - } - -#ifdef RSITEM_DEBUG - std::string out; - rs_sprintf(out, "pqihandler::GetItems() Incoming Item from: %p\n", mod -> pqi); - item -> print_string(out); - - pqioutput(PQL_DEBUG_BASIC, - pqihandlerzone, out); -#endif - - if (item->PeerId() != (mod->pqi)->PeerId()) - { - /* ERROR */ - pqioutput(PQL_ALERT, - pqihandlerzone, "ERROR PeerIds dont match!"); - item->PeerId(mod->pqi->PeerId()); - } - - locked_SortnStoreItem(item); - count++; - } - } - else - { - // not allowed to recieve from here.... - while((item = (mod -> pqi) -> GetItem()) != NULL) - { - std::string out; - rs_sprintf(out, "pqihandler::GetItems() Incoming Item from: %p\n", mod -> pqi); - item -> print_string(out); - out += "\nItem Not Allowed (Sec Pol). deleting!"; - - pqioutput(PQL_DEBUG_BASIC, - pqihandlerzone, out); - - delete item; - } - } - } - return count; -} - -void pqihandler::locked_SortnStoreItem(RsItem *item) -{ - /* get class type / subtype out of the item */ - uint8_t vers = item -> PacketVersion(); - - /* whole Version reserved for SERVICES/CACHES */ - if (vers == RS_PKT_VERSION_SERVICE) - { - pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, - "SortnStore -> Service"); - in_service.push_back(item); - item = NULL; - return; - } - std::cerr << "pqihandler::locked_SortnStoreItem() : unhandled item! Will be deleted. This is certainly a bug." << std::endl; - - if (vers != RS_PKT_VERSION1) - { - pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, "SortnStore -> Invalid VERSION! Deleting!"); - delete item; - item = NULL; - return; - } - - if (item) - { - pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, "SortnStore -> Deleting Unsorted Item"); - delete item; - } - - return; -} - -RsRawItem *pqihandler::GetRsRawItem() -{ - RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/ - - if (in_service.size() != 0) - { - RsRawItem *fi = dynamic_cast(in_service.front()); - if (!fi) { delete in_service.front(); } - in_service.pop_front(); - return fi; - } - return NULL; -} - -///////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////// -// ABOVE CODE SHOULD BE ABLE TO BE REMOVED! -///////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////// - -#endif - -static const float MIN_RATE = 0.01; // 10 B/s - int pqihandler::ExtractTrafficInfo(std::list& out_lst,std::list& in_lst) { in_lst.clear() ;