mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-22 16:09:18 -04:00
Bugfixes for UdpRelayReceiver and removed other warnings.
* Changed udprelay overload from ERROR to WARNING. * Fixed relay time initialisation bug. caused immediate timeout. * Removed lots of OSX warnings for empty loops for(;;); => for(;;) ; git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-peernet@4316 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6cbb9417ff
commit
7f072e6ae5
@ -688,7 +688,7 @@ bool ftTransferModule::checkCRC()
|
||||
int n = rand()%(mFileSources.size()) ;
|
||||
int p=0 ;
|
||||
std::map<std::string,peerInfo>::const_iterator mit ;
|
||||
for(mit = mFileSources.begin();mit != mFileSources.end() && p<n;++mit,++p);
|
||||
for(mit = mFileSources.begin();mit != mFileSources.end() && p<n;++mit,++p) ;
|
||||
|
||||
#ifdef FT_DEBUG
|
||||
std::cerr << "ftTransferModule::checkCRC(): sending CRC map request to source " << mit->first << std::endl ;
|
||||
|
@ -1637,7 +1637,7 @@ bool p3DhtMgr::dhtResultNotify(std::string idhash)
|
||||
time_t now = time(NULL);
|
||||
|
||||
/* if notify - we must match on the second hash */
|
||||
for(it = peers.begin(); (it != peers.end()) && ((it->second).hash2 != idhash); it++);
|
||||
for(it = peers.begin(); (it != peers.end()) && ((it->second).hash2 != idhash); it++) ;
|
||||
|
||||
/* update data */
|
||||
std::string peerid;
|
||||
@ -1697,7 +1697,7 @@ bool p3DhtMgr::dhtResultSearch(std::string idhash,
|
||||
dhtPeerEntry ent;
|
||||
|
||||
/* if search - we must match on the second hash */
|
||||
for(it = peers.begin(); (it != peers.end()) && ((it->second).hash1 != idhash); it++);
|
||||
for(it = peers.begin(); (it != peers.end()) && ((it->second).hash1 != idhash); it++) ;
|
||||
|
||||
/* update data */
|
||||
/* ignore OFF peers */
|
||||
|
@ -611,7 +611,7 @@ bool p3GameLauncher::confirmPeer(std::string gameId, std::string peerId,
|
||||
|
||||
int32_t i = 0;
|
||||
for(it = git->second.peerIds.begin(); (i < pos) &&
|
||||
(it != git->second.peerIds.end()); it++, i++);
|
||||
(it != git->second.peerIds.end()); it++, i++) ;
|
||||
|
||||
if ((pos < 0) || (it == git->second.peerIds.end()))
|
||||
{
|
||||
|
@ -829,7 +829,7 @@ bool p3Ranking::getRankings(uint32_t first, uint32_t count, std::list<std::st
|
||||
|
||||
uint32_t i = 0;
|
||||
std::multimap<float, std::string>::reverse_iterator rit;
|
||||
for(rit = mRankings.rbegin(); (i < first) && (rit != mRankings.rend()); rit++, i++);
|
||||
for(rit = mRankings.rbegin(); (i < first) && (rit != mRankings.rend()); rit++, i++) ;
|
||||
|
||||
i = 0;
|
||||
for(; (i < count) && (rit != mRankings.rend()); rit++, i++)
|
||||
|
@ -283,7 +283,7 @@ int UdpRelayReceiver::addUdpRelay(UdpRelayAddrSet *addrSet, int relayClass)
|
||||
}
|
||||
|
||||
//#ifdef DEBUG_UDP_RELAY
|
||||
std::cerr << "UdpRelayReceiver::addUdpRelay() ERROR Too many Relays!" << std::endl;
|
||||
std::cerr << "UdpRelayReceiver::addUdpRelay() WARNING Too many Relays!" << std::endl;
|
||||
//#endif
|
||||
return 0;
|
||||
}
|
||||
@ -315,7 +315,7 @@ int UdpRelayReceiver::removeUdpRelay_relayLocked(UdpRelayAddrSet *addrSet)
|
||||
if (rit == mRelays.end())
|
||||
{
|
||||
std::cerr << "UdpRelayReceiver::removeUdpRelay()";
|
||||
std::cerr << "Error Finding Alt Relay: " << alt;
|
||||
std::cerr << "ERROR Finding Alt Relay: " << alt;
|
||||
std::cerr << std::endl;
|
||||
/* ERROR */
|
||||
}
|
||||
@ -332,7 +332,7 @@ int UdpRelayReceiver::installRelayClass_relayLocked(int classIdx)
|
||||
/* check for total number of Relays */
|
||||
if (mClassCount[UDP_RELAY_CLASS_ALL] >= mClassLimit[UDP_RELAY_CLASS_ALL])
|
||||
{
|
||||
std::cerr << "UdpRelayReceiver::installRelayClass() ERROR Too many Relays already";
|
||||
std::cerr << "UdpRelayReceiver::installRelayClass() WARNING Too many Relays already";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
@ -348,7 +348,7 @@ int UdpRelayReceiver::installRelayClass_relayLocked(int classIdx)
|
||||
/* now check the specifics of the class */
|
||||
if (mClassCount[classIdx] >= mClassLimit[classIdx])
|
||||
{
|
||||
std::cerr << "UdpRelayReceiver::installRelayClass() ERROR Relay Class Limit Exceeded";
|
||||
std::cerr << "UdpRelayReceiver::installRelayClass() WARNING Relay Class Limit Exceeded";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return 0;
|
||||
@ -797,7 +797,7 @@ UdpRelayProxy::UdpRelayProxy()
|
||||
mBandwidth = 0;
|
||||
mDataSize = 0;
|
||||
mLastBandwidthTS = 0;
|
||||
mLastTS = 0;
|
||||
mLastTS = time(NULL); // Must be set here, otherwise Proxy Timesout before anything can happen!
|
||||
mRelayClass = 0;
|
||||
}
|
||||
|
||||
@ -809,7 +809,7 @@ UdpRelayProxy::UdpRelayProxy(UdpRelayAddrSet *addrSet, int relayClass)
|
||||
mBandwidth = 0;
|
||||
mDataSize = 0;
|
||||
mLastBandwidthTS = 0;
|
||||
mLastTS = 0;
|
||||
mLastTS = time(NULL);
|
||||
}
|
||||
|
||||
UdpRelayEnd::UdpRelayEnd()
|
||||
|
@ -845,7 +845,7 @@ bool UdpStunner::getStunPeer(int idx, std::string &id,
|
||||
|
||||
std::list<TouStunPeer>::iterator it;
|
||||
int i;
|
||||
for(i=0, it=mStunList.begin(); (i<idx) && (it!=mStunList.end()); it++, i++);
|
||||
for(i=0, it=mStunList.begin(); (i<idx) && (it!=mStunList.end()); it++, i++) ;
|
||||
|
||||
if (it != mStunList.end())
|
||||
{
|
||||
|
@ -64,8 +64,8 @@ std::string RsDirUtil::getTopDir(const std::string& dir)
|
||||
*/
|
||||
int i,j;
|
||||
int len = dir.length();
|
||||
for(j = len - 1; (j > 0) && (dir[j] == '/'); j--);
|
||||
for(i = j; (i > 0) && (dir[i] != '/'); i--);
|
||||
for(j = len - 1; (j > 0) && (dir[j] == '/'); j--) ;
|
||||
for(i = j; (i > 0) && (dir[i] != '/'); i--) ;
|
||||
|
||||
if (dir[i] == '/')
|
||||
i++;
|
||||
@ -165,11 +165,11 @@ std::string RsDirUtil::removeTopDir(const std::string& dir)
|
||||
*/
|
||||
int i,j;
|
||||
int len = dir.length();
|
||||
for(j = len - 1; (j > 0) && (dir[j] == '/'); j--);
|
||||
for(i = j; (i >= 0) && (dir[i] != '/'); i--);
|
||||
for(j = len - 1; (j > 0) && (dir[j] == '/'); j--) ;
|
||||
for(i = j; (i >= 0) && (dir[i] != '/'); i--) ;
|
||||
|
||||
/* remove any more slashes */
|
||||
for(; (i >= 0) && (dir[i] == '/'); i--);
|
||||
for(; (i >= 0) && (dir[i] == '/'); i--) ;
|
||||
|
||||
for(j = 0; j <= i; j++)
|
||||
{
|
||||
@ -187,8 +187,8 @@ std::string RsDirUtil::getRootDir(const std::string& dir)
|
||||
*/
|
||||
int i,j;
|
||||
int len = dir.length();
|
||||
for(i = 0; (i < len) && (dir[i] == '/'); i++);
|
||||
for(j = i; (j < len) && (dir[j] != '/'); j++);
|
||||
for(i = 0; (i < len) && (dir[i] == '/'); i++) ;
|
||||
for(j = i; (j < len) && (dir[j] != '/'); j++) ;
|
||||
if (i == j)
|
||||
return root; /* empty */
|
||||
for(; i < j; i++)
|
||||
@ -205,12 +205,12 @@ std::string RsDirUtil::removeRootDir(const std::string& path)
|
||||
std::string output;
|
||||
|
||||
/* chew leading '/'s */
|
||||
for(i = 0; (i < len) && (path[i] == '/'); i++);
|
||||
for(i = 0; (i < len) && (path[i] == '/'); i++) ;
|
||||
if (i == len)
|
||||
return output; /* empty string */
|
||||
|
||||
for(j = i; (j < len) && (path[j] != '/'); j++); /* run to next '/' */
|
||||
for(; (j < len) && (path[j] == '/'); j++); /* chew leading '/'s */
|
||||
for(j = i; (j < len) && (path[j] != '/'); j++) ; /* run to next '/' */
|
||||
for(; (j < len) && (path[j] == '/'); j++) ; /* chew leading '/'s */
|
||||
|
||||
for(; j < len; j++)
|
||||
{
|
||||
@ -236,7 +236,7 @@ std::string RsDirUtil::removeRootDirs(const std::string& path, const std::string
|
||||
i++;
|
||||
}
|
||||
|
||||
for(; (i < path.length()) && (j < root.length()) && (path[i] == root[j]); i++, j++);
|
||||
for(; (i < path.length()) && (j < root.length()) && (path[i] == root[j]); i++, j++) ;
|
||||
|
||||
/* should have consumed root. */
|
||||
if (j == root.length())
|
||||
|
Loading…
x
Reference in New Issue
Block a user