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 discovery reply then respond if haven't already.
if (NULL != (dri = dynamic_cast<RsDiscReply *> (item))) { if (NULL != (dri = dynamic_cast<RsDiscReply *> (item))) {
recvPeerDetails(dri); // add item to list for later process
nhandled++; discReplyList.push_back(dri); // no delete
} }
else if (NULL != (dvi = dynamic_cast<RsDiscVersion *> (item))) { else if (NULL != (dvi = dynamic_cast<RsDiscVersion *> (item))) {
recvPeerVersionMsg(dvi); recvPeerVersionMsg(dvi);
nhandled++; nhandled++;
delete item;
} }
else if (NULL != (inf = dynamic_cast<RsDiscAskInfo *> (item))) /* Ping */ { else if (NULL != (inf = dynamic_cast<RsDiscAskInfo *> (item))) /* Ping */ {
recvAskInfo(inf); recvAskInfo(inf);
nhandled++; nhandled++;
delete item;
} }
else if (NULL != (dta = dynamic_cast<RsDiscHeartbeat *> (item))) { else if (NULL != (dta = dynamic_cast<RsDiscHeartbeat *> (item))) {
recvHeartbeatMsg(dta); recvHeartbeatMsg(dta);
nhandled++ ; nhandled++ ;
delete item;
} }
else else
{ {
@ -190,9 +193,18 @@ int p3disc::handleIncoming()
item -> print(std::cerr); item -> print(std::cerr);
std::cerr << std::endl; std::cerr << std::endl;
#endif #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 #ifdef P3DISC_DEBUG

View File

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