Stack for incoming RsDiscReply items to give RetroShare time to send heartbeats and process other services.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3524 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-22 23:45:54 +00:00
parent 077b2871f1
commit addb330205
2 changed files with 18 additions and 4 deletions

View File

@ -168,20 +168,23 @@ int p3disc::handleIncoming()
// if discovery reply then respond if haven't already.
if (NULL != (dri = dynamic_cast<RsDiscReply *> (item))) {
recvPeerDetails(dri);
nhandled++;
// add item to list for later process
discReplyList.push_back(dri); // no delete
}
else if (NULL != (dvi = dynamic_cast<RsDiscVersion *> (item))) {
recvPeerVersionMsg(dvi);
nhandled++;
delete item;
}
else if (NULL != (inf = dynamic_cast<RsDiscAskInfo *> (item))) /* Ping */ {
recvAskInfo(inf);
nhandled++;
delete item;
}
else if (NULL != (dta = dynamic_cast<RsDiscHeartbeat *> (item))) {
recvHeartbeatMsg(dta);
nhandled++ ;
delete item;
}
else
{
@ -190,9 +193,18 @@ int p3disc::handleIncoming()
item -> print(std::cerr);
std::cerr << std::endl;
#endif
delete item;
}
delete item;
}
// process one disc item
if (!discReplyList.empty()) {
std::cerr << "p3disc::handleIncoming() Count of disc items " << discReplyList.size() << std::endl;
RsDiscReply *dri = discReplyList.front();
discReplyList.pop_front();
recvPeerDetails(dri);
nhandled++;
delete dri;
}
#ifdef P3DISC_DEBUG

View File

@ -145,6 +145,8 @@ int idServers();
std::map<std::string, autoneighbour> neighbours;
std::map<std::string, std::string> versions;
std::list<RsDiscReply*> discReplyList;
};