added proof of work algorithms to GRouter key items

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6984 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-01-03 22:41:20 +00:00
parent 469da4914f
commit 91291a9920
4 changed files with 145 additions and 11 deletions

View file

@ -361,7 +361,6 @@ void p3GRouter::locked_forwardKey(const RsGRouterPublishKeyItem& item)
else
std::cerr << " Not forwarding to source id " << item.PeerId() << std::endl;
}
bool p3GRouter::registerKey(const GRouterKeyId& key,const GRouterServiceId& client_id,const std::string& description)
{
RsStackMutex mtx(grMtx) ;
@ -381,6 +380,27 @@ bool p3GRouter::registerKey(const GRouterKeyId& key,const GRouterServiceId& clie
return true ;
}
bool p3GRouter::unregisterKey(const GRouterKeyId& key)
{
RsStackMutex mtx(grMtx) ;
std::map<GRouterKeyId,GRouterPublishedKeyInfo>::iterator it = _owned_key_ids.find(key) ;
if(it == _owned_key_ids.end())
{
std::cerr << "p3GRouter::unregisterKey(): key " << key.toStdString() << " not found." << std::endl;
return false ;
}
std::cerr << "p3GRouter::unregistered the following key: " << std::endl;
std::cerr << " Key id : " << key.toStdString() << std::endl;
std::cerr << " Client id : " << std::hex << it->second.service_id << std::dec << std::endl;
std::cerr << " Description : " << it->second.description_string << std::endl;
_owned_key_ids.erase(it) ;
return true ;
}
void p3GRouter::handleIncoming()
{