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