Integration with libbitdht.

* Added debuging #defs for annoying output.
 * fixed compiler "unused parameter" warning for rsiface.h



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3327 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-08-01 18:22:37 +00:00
parent f876dcb93b
commit 74b36a6af6
4 changed files with 29 additions and 12 deletions

View File

@ -136,7 +136,7 @@ bool CacheSource::clearCache(CacheId id)
return ret; return ret;
} }
bool CacheSource::cachesAvailable(RsPeerId pid, std::map<CacheId, CacheData> &ids) bool CacheSource::cachesAvailable(RsPeerId /* pid */, std::map<CacheId, CacheData> &ids)
{ {
lockData(); /* LOCK MUTEX */ lockData(); /* LOCK MUTEX */
@ -385,6 +385,7 @@ void CacheStore::downloadedCache(const CacheData &data)
/* called when the download is completed ... updates internal data */ /* called when the download is completed ... updates internal data */
void CacheStore::failedCache(const CacheData &data) void CacheStore::failedCache(const CacheData &data)
{ {
(void) data;
#ifdef CS_DEBUG #ifdef CS_DEBUG
std::cerr << "CacheStore::failedCache() :" << data << std::endl; std::cerr << "CacheStore::failedCache() :" << data << std::endl;
#endif #endif
@ -575,9 +576,8 @@ void CacheStrapper::refreshCache(const CacheData &data)
} }
void CacheStrapper::refreshCacheStore(const CacheData &data) void CacheStrapper::refreshCacheStore(const CacheData & /* data */ )
{ {
/* indicate to save data */ /* indicate to save data */
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
@ -595,7 +595,7 @@ bool CacheStrapper::getCacheUpdates(std::list<std::pair<RsPeerId, CacheData> > &
/* pass to correct CacheSet */ /* pass to correct CacheSet */
void CacheStrapper::recvCacheResponse(CacheData &data, time_t ts) void CacheStrapper::recvCacheResponse(CacheData &data, time_t /* ts */)
{ {
/* find cache store */ /* find cache store */
std::map<uint16_t, CachePair>::iterator it2; std::map<uint16_t, CachePair>::iterator it2;
@ -666,7 +666,7 @@ void CacheStrapper::listCaches(std::ostream &out)
return; return;
} }
void CacheStrapper::listPeerStatus(std::ostream &out) void CacheStrapper::listPeerStatus(std::ostream & /* out */)
{ {
#if 0 #if 0
std::map<RsPeerId, CacheTS>::iterator it; std::map<RsPeerId, CacheTS>::iterator it;
@ -1040,6 +1040,9 @@ bool CacheTransfer::RequestCache(CacheData &data, CacheStore *cbStore)
/* to be overloaded */ /* to be overloaded */
bool CacheTransfer::RequestCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size) bool CacheTransfer::RequestCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size)
{ {
(void) id;
(void) path;
(void) size;
#ifdef CS_DEBUG #ifdef CS_DEBUG
std::cerr << "CacheTransfer::RequestCacheFile() : from:" << id << " #"; std::cerr << "CacheTransfer::RequestCacheFile() : from:" << id << " #";
std::cerr << hash << " size: " << size; std::cerr << hash << " size: " << size;
@ -1056,6 +1059,10 @@ bool CacheTransfer::RequestCacheFile(RsPeerId id, std::string path, std::string
/* to be overloaded */ /* to be overloaded */
bool CacheTransfer::CancelCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size) bool CacheTransfer::CancelCacheFile(RsPeerId id, std::string path, std::string hash, uint64_t size)
{ {
(void) id;
(void) path;
(void) hash;
(void) size;
#ifdef CS_DEBUG #ifdef CS_DEBUG
std::cerr << "CacheTransfer::CancelCacheFile() : from:" << id << " #"; std::cerr << "CacheTransfer::CancelCacheFile() : from:" << id << " #";
std::cerr << hash << " size: " << size; std::cerr << hash << " size: " << size;

View File

@ -265,8 +265,10 @@ int p3BitDht::lookupRsId(const bdNodeId *id, std::string &pid)
nit = mTransToRsId.find(*id); nit = mTransToRsId.find(*id);
if (nit == mTransToRsId.end()) if (nit == mTransToRsId.end())
{ {
#ifdef DEBUG_BITDHT
std::cerr << "p3BitDht::lookupRsId() failed"; std::cerr << "p3BitDht::lookupRsId() failed";
std::cerr << std::endl; std::cerr << std::endl;
#endif
return 0; return 0;
} }
@ -319,8 +321,10 @@ int p3BitDht::removeTranslation(const std::string pid)
/********************** Callback Functions **************************/ /********************** Callback Functions **************************/
int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags) int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
{ {
#ifdef DEBUG_BITDHT
std::cerr << "p3BitDht::NodeCallback()"; std::cerr << "p3BitDht::NodeCallback()";
std::cerr << std::endl; std::cerr << std::endl;
#endif
/* is it one that we are interested in? */ /* is it one that we are interested in? */
std::string pid; std::string pid;
@ -330,6 +334,13 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
/* we found it ... do callback to p3connmgr */ /* we found it ... do callback to p3connmgr */
//uint32_t cbflags = ONLINE | UNREACHABLE; //uint32_t cbflags = ONLINE | UNREACHABLE;
for(int i = 0; i < 10; i++)
{
std::cerr << "p3BitDht::NodeCallback() FOUND NODE!!!: ";
std::cerr << pid << " flags: " << peerflags;
std::cerr << std::endl;
}
return 1; return 1;
} }

View File

@ -200,16 +200,16 @@ class NotifyBase
virtual void notifyListChange(int list, int type) { (void) list; (void) type; return; } virtual void notifyListChange(int list, int type) { (void) list; (void) type; return; }
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; } virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
virtual void notifyChat() { return; } virtual void notifyChat() { return; }
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private) {} virtual void notifyChatStatus(const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) {}
virtual void notifyCustomState(const std::string& peer_id) {} virtual void notifyCustomState(const std::string& /* peer_id */) {}
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; } virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; } virtual void notifyTurtleSearchResult(uint32_t /* search_id */ ,const std::list<TurtleFileInfo>& files) { (void)files; }
virtual void notifyPeerHasNewAvatar(std::string peer_id) { (void)peer_id; } virtual void notifyPeerHasNewAvatar(std::string peer_id) { (void)peer_id; }
virtual void notifyOwnAvatarChanged() {} virtual void notifyOwnAvatarChanged() {}
virtual void notifyOwnStatusMessageChanged() {} virtual void notifyOwnStatusMessageChanged() {}
virtual void notifyDiskFull(uint32_t /* location */,uint32_t /* size limit in MB */) {} virtual void notifyDiskFull(uint32_t /* location */,uint32_t /* size limit in MB */) {}
virtual std::string askForPassword(const std::string& key_details,bool prev_is_bad) { return "" ;} virtual std::string askForPassword(const std::string& /* key_details */ ,bool /* prev_is_bad */ ) { return "" ;}
}; };
const int NOTIFY_LIST_NEIGHBOURS = 1; const int NOTIFY_LIST_NEIGHBOURS = 1;

View File

@ -120,8 +120,7 @@ int tou_socket(int /*domain*/, int /*type*/, int /*protocol*/)
} }
/* bind - opens the udp port */ /* bind - opens the udp port */
int tou_bind(int sockfd, const struct sockaddr *my_addr, int tou_bind(int sockfd, const struct sockaddr * /* my_addr */, socklen_t /* addrlen */ )
socklen_t addrlen)
{ {
if (tou_streams[sockfd] == NULL) if (tou_streams[sockfd] == NULL)
{ {
@ -208,7 +207,7 @@ int tou_listenfor(int sockfd, const struct sockaddr *serv_addr,
return 0; return 0;
} }
int tou_listen(int sockfd, int backlog) int tou_listen(int /* sockfd */ , int /* backlog */ )
{ {
tou_tick_all(); tou_tick_all();
return 1; return 1;