mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-18 02:50:47 -04:00
Merging branches/v0.6-initdev into trunk.
These split at 6672 -> 7075, so quite a bit merge. libretroshare compiles - but untested. retroshare-gui needs GenCertDialog.ui and IdEditDialog.ui to be properly merged. (compile errors). some plugins will be broken. retroshare-nogui is untested. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
commit
c0738eec7f
407 changed files with 23716 additions and 50779 deletions
|
@ -30,6 +30,7 @@
|
|||
|
||||
|
||||
#include "pqi/pqi.h"
|
||||
#include "util/rsnet.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
|
@ -45,12 +46,13 @@ static const int CONNECT_FAILED = 5;
|
|||
static const int HEARTBEAT_REPEAT_TIME = 5;
|
||||
|
||||
#include "pqi/pqiqosstreamer.h"
|
||||
#include "pqi/pqithreadstreamer.h"
|
||||
|
||||
class pqiconnect: public pqiQoSstreamer, public NetInterface
|
||||
{
|
||||
public:
|
||||
pqiconnect(RsSerialiser *rss, NetBinInterface *ni_in)
|
||||
:pqiQoSstreamer(rss, ni_in->PeerId(), ni_in, 0), // pqistreamer will cleanup NetInterface.
|
||||
pqiconnect(PQInterface *parent, RsSerialiser *rss, NetBinInterface *ni_in)
|
||||
:pqiQoSstreamer(parent, rss, ni_in->PeerId(), ni_in, 0), // pqistreamer will cleanup NetInterface.
|
||||
NetInterface(NULL, ni_in->PeerId()), // No need for callback
|
||||
ni(ni_in)
|
||||
{
|
||||
|
@ -67,17 +69,17 @@ virtual ~pqiconnect() { return; }
|
|||
virtual bool getCryptoParams(RsPeerCryptoParams& params) ;
|
||||
|
||||
// presents a virtual NetInterface -> passes to ni.
|
||||
virtual int connect(struct sockaddr_in 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 stoplistening() { return ni -> stoplistening(); }
|
||||
virtual int reset() { 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_additional_address(uint32_t type, struct sockaddr_in *addr) { return ni -> connect_additional_address(type, addr);}
|
||||
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 int getConnectAddress(struct sockaddr_in &raddr){ return ni->getConnectAddress(raddr); }
|
||||
virtual int getConnectAddress(struct sockaddr_storage &raddr){ return ni->getConnectAddress(raddr); }
|
||||
|
||||
// get the contact from the net side!
|
||||
virtual std::string PeerId()
|
||||
|
@ -102,6 +104,25 @@ protected:
|
|||
|
||||
class pqipersongrp;
|
||||
|
||||
|
||||
class NotifyData
|
||||
{
|
||||
public:
|
||||
NotifyData()
|
||||
:mNi(NULL), mState(0)
|
||||
{
|
||||
sockaddr_storage_clear(mAddr);
|
||||
}
|
||||
|
||||
NotifyData(NetInterface *ni, int state, const struct sockaddr_storage &addr)
|
||||
:mNi(ni), mState(state), mAddr(addr) { return; }
|
||||
|
||||
NetInterface *mNi;
|
||||
int mState;
|
||||
struct sockaddr_storage mAddr;
|
||||
};
|
||||
|
||||
|
||||
class pqiperson: public PQInterface
|
||||
{
|
||||
public:
|
||||
|
@ -113,10 +134,13 @@ int reset();
|
|||
int listen();
|
||||
int stoplistening();
|
||||
|
||||
int connect(uint32_t type, struct sockaddr_in raddr,
|
||||
struct sockaddr_in &proxyaddr, struct sockaddr_in &srcaddr,
|
||||
uint32_t delay, uint32_t period, uint32_t timeout, uint32_t flags, uint32_t bandwidth);
|
||||
|
||||
int connect(uint32_t type, const struct sockaddr_storage &raddr,
|
||||
const struct sockaddr_storage &proxyaddr, const struct sockaddr_storage &srcaddr,
|
||||
uint32_t delay, uint32_t period, uint32_t timeout, uint32_t flags, uint32_t bandwidth,
|
||||
const std::string &domain_addr, uint16_t domain_port);
|
||||
|
||||
int fullstopthreads();
|
||||
|
||||
int receiveHeartbeat();
|
||||
// add in connection method.
|
||||
int addChildInterface(uint32_t type, pqiconnect *pqi);
|
||||
|
@ -132,12 +156,13 @@ virtual int SendItem(RsItem *item)
|
|||
return SendItem(item,serialized_size) ;
|
||||
}
|
||||
virtual RsItem *GetItem();
|
||||
virtual bool RecvItem(RsItem *item);
|
||||
|
||||
virtual int status();
|
||||
virtual int tick();
|
||||
|
||||
// overloaded callback function for the child - notify of a change.
|
||||
int notifyEvent(NetInterface *ni, int event);
|
||||
virtual int notifyEvent(NetInterface *ni, int event, const struct sockaddr_storage &addr);
|
||||
|
||||
// PQInterface for rate control overloaded....
|
||||
virtual int getQueueSize(bool in);
|
||||
|
@ -146,10 +171,22 @@ virtual float getRate(bool in);
|
|||
virtual void setMaxRate(bool in, float val);
|
||||
virtual void setRateCap(float val_in, float val_out);
|
||||
|
||||
pqiconnect *getKid(uint32_t type);
|
||||
|
||||
private:
|
||||
|
||||
void processNotifyEvents();
|
||||
int handleNotifyEvent_locked(NetInterface *ni, int event, const struct sockaddr_storage &addr);
|
||||
|
||||
RsMutex mNotifyMtx; /**** LOCKS Notify Queue ****/
|
||||
|
||||
std::list<NotifyData> mNotifyQueue;
|
||||
|
||||
RsMutex mPersonMtx; /**** LOCKS below ****/
|
||||
|
||||
int reset_locked();
|
||||
|
||||
void setRateCap_locked(float val_in, float val_out);
|
||||
|
||||
std::map<uint32_t, pqiconnect *> kids;
|
||||
bool active;
|
||||
pqiconnect *activepqi;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue