added missing mutex protection that caused random SIGSEGV

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4433 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-07-11 19:04:56 +00:00
parent 20c44c4bca
commit e4f89892a3

View file

@ -165,7 +165,7 @@ 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))) {
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
@ -182,17 +182,17 @@ int p3disc::handleIncoming()
// add item to list for later process // add item to list for later process
pendingDiscReplyInList.push_back(dri); // no delete pendingDiscReplyInList.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; 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; 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; delete item;
@ -764,6 +764,7 @@ void p3disc::recvAskInfo(RsDiscAskInfo *item) {
std::cerr << "p3disc::recvAskInfo() From: " << item->PeerId(); std::cerr << "p3disc::recvAskInfo() From: " << item->PeerId();
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
std::list<std::string> &idList = sendIdList[item->PeerId()]; std::list<std::string> &idList = sendIdList[item->PeerId()];