mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #117 from G10h4ck/master
Remove some garbage from pqissl
This commit is contained in:
commit
b055500245
@ -48,57 +48,36 @@ static const int HEARTBEAT_REPEAT_TIME = 5;
|
|||||||
#include "pqi/pqiqosstreamer.h"
|
#include "pqi/pqiqosstreamer.h"
|
||||||
#include "pqi/pqithreadstreamer.h"
|
#include "pqi/pqithreadstreamer.h"
|
||||||
|
|
||||||
class pqiconnect: public pqiQoSstreamer, public NetInterface
|
class pqiconnect : public pqiQoSstreamer, public NetInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pqiconnect(PQInterface *parent, RsSerialiser *rss, NetBinInterface *ni_in)
|
pqiconnect(PQInterface *parent, RsSerialiser *rss, NetBinInterface *ni_in) :
|
||||||
:pqiQoSstreamer(parent, rss, ni_in->PeerId(), ni_in, 0), // pqistreamer will cleanup NetInterface.
|
pqiQoSstreamer(parent, rss, ni_in->PeerId(), ni_in, 0), // pqistreamer will cleanup NetInterface.
|
||||||
NetInterface(NULL, ni_in->PeerId()), // No need for callback
|
NetInterface(NULL, ni_in->PeerId()), // No need for callback
|
||||||
ni(ni_in)
|
ni(ni_in) {}
|
||||||
{
|
|
||||||
if (!ni_in)
|
|
||||||
{
|
|
||||||
std::cerr << "pqiconnect::pqiconnect() NetInterface == NULL, FATAL!";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~pqiconnect() { return; }
|
virtual ~pqiconnect() {}
|
||||||
virtual bool getCryptoParams(RsPeerCryptoParams& params) ;
|
virtual bool getCryptoParams(RsPeerCryptoParams& params);
|
||||||
|
|
||||||
// presents a virtual NetInterface -> passes to ni.
|
// presents a virtual NetInterface -> passes to ni.
|
||||||
virtual int connect(const struct sockaddr_storage &raddr) { return ni->connect(raddr); }
|
virtual int connect(const struct sockaddr_storage &raddr) { return ni->connect(raddr); }
|
||||||
virtual int listen() { return ni -> listen(); }
|
virtual int listen() { return ni->listen(); }
|
||||||
virtual int stoplistening() { return ni -> stoplistening(); }
|
virtual int stoplistening() { return ni->stoplistening(); }
|
||||||
virtual int reset() { return ni -> reset(); }
|
virtual int reset() { return ni->reset(); }
|
||||||
virtual int disconnect() { return ni -> reset(); }
|
virtual int disconnect() { return ni->reset(); }
|
||||||
virtual bool connect_parameter(uint32_t type, uint32_t value) { return ni -> connect_parameter(type, value);}
|
virtual bool connect_parameter(uint32_t type, uint32_t value) { return ni->connect_parameter(type, value);}
|
||||||
virtual bool connect_parameter(uint32_t type, std::string value) { return ni -> connect_parameter(type, value);}
|
virtual bool connect_parameter(uint32_t type, std::string value) { return ni->connect_parameter(type, value);}
|
||||||
virtual bool connect_additional_address(uint32_t type, const struct sockaddr_storage &addr) { return ni -> connect_additional_address(type, addr);}
|
virtual bool connect_additional_address(uint32_t type, const struct sockaddr_storage &addr) { return ni->connect_additional_address(type, addr); }
|
||||||
|
virtual int getConnectAddress(struct sockaddr_storage &raddr){ return ni->getConnectAddress(raddr); }
|
||||||
|
|
||||||
virtual int getConnectAddress(struct sockaddr_storage &raddr){ return ni->getConnectAddress(raddr); }
|
|
||||||
|
|
||||||
// get the contact from the net side!
|
// get the contact from the net side!
|
||||||
virtual const RsPeerId& PeerId()
|
virtual const RsPeerId& PeerId() { return ni->PeerId(); }
|
||||||
{
|
|
||||||
if (ni)
|
|
||||||
{
|
|
||||||
return ni->PeerId();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return PQInterface::PeerId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// to check if our interface.
|
// to check if our interface.
|
||||||
virtual bool thisNetInterface(NetInterface *ni_in) { return (ni_in == ni); }
|
virtual bool thisNetInterface(NetInterface *ni_in) { return (ni_in == ni); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NetBinInterface *ni;
|
NetBinInterface *ni;
|
||||||
protected:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,54 +286,40 @@ int pqissl::reset_locked()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pqissl::connect_parameter(uint32_t type, const std::string &value)
|
|
||||||
{
|
|
||||||
RsStackMutex stack(mSslMtx); /**** LOCKED MUTEX ****/
|
|
||||||
|
|
||||||
/* remove unused parameter warnings */
|
|
||||||
(void) type;
|
|
||||||
(void) value;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
{
|
std::cerr << "pqissl::connect_parameter() Peer: " << PeerId();
|
||||||
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)
|
||||||
|
{
|
||||||
|
case NET_PARAM_CONNECT_DELAY:
|
||||||
{
|
{
|
||||||
#ifdef PQISSL_LOG_DEBUG
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
std::string out = "pqissl::connect_parameter() Peer: " + PeerId();
|
std::cerr << " DELAY: " << value << std::endl;
|
||||||
rs_sprintf_append(out, " DELAY: %u", value);
|
|
||||||
rslog(RSL_DEBUG_BASIC, pqisslzone, out);
|
|
||||||
#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;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
#ifdef PQISSL_LOG_DEBUG
|
||||||
|
std::cerr << " type: " << type << " value: " << value << std::endl;
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
//return NetInterface::connect_parameter(type, value);
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ virtual int reset();
|
|||||||
virtual int disconnect();
|
virtual int disconnect();
|
||||||
virtual int getConnectAddress(struct sockaddr_storage &raddr);
|
virtual int getConnectAddress(struct sockaddr_storage &raddr);
|
||||||
|
|
||||||
virtual bool connect_parameter(uint32_t type, const std::string &value);
|
virtual bool connect_parameter(uint32_t /*type*/, const std::string & /*value*/) { return false; }
|
||||||
virtual bool connect_parameter(uint32_t type, uint32_t value);
|
virtual bool connect_parameter(uint32_t type, uint32_t value);
|
||||||
|
|
||||||
// BinInterface
|
// BinInterface
|
||||||
|
Loading…
Reference in New Issue
Block a user