replaced some ifs with switch

This commit is contained in:
sehraf 2015-09-07 23:40:52 +02:00
parent fed43450ae
commit 4fc6c73dd9
2 changed files with 14 additions and 4 deletions

View File

@ -2026,11 +2026,16 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer,
peerConnectAddress pca;
pca.addr = proxy_addr;
if (mPeerMgr->hiddenDomainToHiddenType(domain_addr) == RS_HIDDEN_TYPE_I2P)
switch (mPeerMgr->hiddenDomainToHiddenType(domain_addr)) {
case RS_HIDDEN_TYPE_I2P:
pca.type = RS_NET_CONN_TCP_HIDDEN_I2P;
else
break;
case RS_HIDDEN_TYPE_TOR:
default:
/* default tor */
pca.type = RS_NET_CONN_TCP_HIDDEN_TOR;
break;
}
//for the delay, we add a random time and some more time when the friend list is big
pca.delay = P3CONNMGR_TCP_DEFAULT_DELAY;

View File

@ -637,11 +637,16 @@ bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_stor
domain_addr = it->second.hiddenDomain;
domain_port = it->second.hiddenPort;
if(it->second.hiddenType == RS_HIDDEN_TYPE_I2P)
switch (it->second.hiddenType) {
case RS_HIDDEN_TYPE_I2P:
proxy_addr = mProxyServerAddressI2P;
else
break;
case RS_HIDDEN_TYPE_TOR:
default:
/* default tor */
proxy_addr = mProxyServerAddressTor;
break;
}
return true;
}