Write in a sane way pqissl::connect_parameter

This commit is contained in:
Gio 2015-09-27 15:29:32 +02:00
parent b16ecc89c8
commit 28b9a443a2

View File

@ -288,41 +288,38 @@ int pqissl::reset_locked()
bool pqissl::connect_parameter(uint32_t type, uint32_t value)
{
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
#ifdef PQISSL_LOG_DEBUG
{
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
rs_sprintf_append(out, " type: %u value: %u", type, value);
rslog(RSL_DEBUG_ALL, pqisslzone, out);
}
#ifdef PQISSL_LOG_DEBUG
std::cerr << "pqissl::connect_parameter() Peer: " << PeerId();
#endif
if (type == NET_PARAM_CONNECT_DELAY)
switch(type)
{
#ifdef PQISSL_LOG_DEBUG
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
rs_sprintf_append(out, " DELAY: %u", value);
rslog(RSL_DEBUG_BASIC, pqisslzone, out);
case NET_PARAM_CONNECT_DELAY:
{
#ifdef PQISSL_LOG_DEBUG
std::cerr << " DELAY: " << value << std::endl;
#endif
RS_STACK_MUTEX(mSslMtx);
mConnectDelay = value;
return true;
}
else if (type == NET_PARAM_CONNECT_TIMEOUT)
case NET_PARAM_CONNECT_TIMEOUT:
{
#ifdef PQISSL_LOG_DEBUG
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
rs_sprintf_append(out, " TIMEOUT: %u", value);
rslog(RSL_DEBUG_BASIC, pqisslzone, out);
#ifdef PQISSL_LOG_DEBUG
std::cerr << " TIMEOUT: " << value << std::endl;
#endif
RS_STACK_MUTEX(mSslMtx);
mConnectTimeout = value;
return true;
}
return false;
//return NetInterface::connect_parameter(type, value);
default:
{
#ifdef PQISSL_LOG_DEBUG
std::cerr << " type: " << type << " value: " << value << std::endl;
#endif
return false;
}
}
}