mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 14:42:51 -04:00
Fixed up bootstrap singleshot search function. Now returns parameters.
Not functioning 100% correctly yet - due to libbitdht behaviour (TO FIX) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6005 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
766d156315
commit
5803a5ab65
2 changed files with 66 additions and 1 deletions
|
@ -18,7 +18,11 @@ bool bdSingleShotFindPeer(const std::string bootstrapfile, const std::string pee
|
|||
|
||||
/* install search node */
|
||||
bdNodeId searchId;
|
||||
bdStdRandomNodeId(&searchId);
|
||||
if (!bdStdLoadNodeId(&searchId, peerId))
|
||||
{
|
||||
std::cerr << "bdSingleShotFindPeer(): Invalid Input Id: " << peerId;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "bssdht: searching for Id: ";
|
||||
bdStdPrintNodeId(std::cerr, &searchId);
|
||||
|
@ -48,6 +52,26 @@ bool bdSingleShotFindPeer(const std::string bootstrapfile, const std::string pee
|
|||
|
||||
dht.shutdown();
|
||||
|
||||
if ((status == BITDHT_QUERY_PEER_UNREACHABLE) ||
|
||||
(status == BITDHT_QUERY_SUCCESS))
|
||||
{
|
||||
|
||||
peer_ip = bdnet_inet_ntoa(resultId.addr.sin_addr);
|
||||
peer_port = ntohs(resultId.addr.sin_port);
|
||||
|
||||
std::cerr << "Answer: ";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tPeer IpAddress: " << peer_ip;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "\tPeer Port: " << peer_port;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Sorry, Cant be found!";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue