From 28b9a443a2aa4a6cafe9237fd60174e88b84e51a Mon Sep 17 00:00:00 2001 From: Gio Date: Sun, 27 Sep 2015 15:29:32 +0200 Subject: [PATCH] Write in a sane way pqissl::connect_parameter --- libretroshare/src/pqi/pqissl.cc | 43 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/libretroshare/src/pqi/pqissl.cc b/libretroshare/src/pqi/pqissl.cc index a667dec61..50a279f5f 100644 --- a/libretroshare/src/pqi/pqissl.cc +++ b/libretroshare/src/pqi/pqissl.cc @@ -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; + } + } }