optimizations

* reduced calls to mPeermgr
* use switch convenience
* small fixes
This commit is contained in:
sehraf 2015-09-15 17:10:48 +02:00
parent bfcf43f0e1
commit d24b281948
7 changed files with 105 additions and 56 deletions

View file

@ -617,20 +617,19 @@ int pqipersongrp::connectPeer(const RsPeerId& id
uint32_t ptype;
if (type & RS_NET_CONN_TCP_ALL)
{
if (type == RS_NET_CONN_TCP_HIDDEN_TOR)
{
switch (type) {
case RS_NET_CONN_TCP_HIDDEN_TOR:
ptype = PQI_CONNECT_HIDDEN_TOR_TCP;
timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
}
else if (type == RS_NET_CONN_TCP_HIDDEN_I2P)
{
break;
case RS_NET_CONN_TCP_HIDDEN_I2P:
ptype = PQI_CONNECT_HIDDEN_I2P_TCP;
timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
}
else
{
break;
default:
ptype = PQI_CONNECT_TCP;
timeout = RS_TCP_STD_TIMEOUT_PERIOD;
timeout = RS_TCP_STD_TIMEOUT_PERIOD;
break;
}
#ifdef PGRP_DEBUG
std::cerr << " pqipersongrp::connectPeer() connecting with TCP: Timeout :" << timeout;