mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-01 10:46:23 -04:00
Lots of little changes to libretroshare. Improvements mainly focused
on configuration storage and loading: * Improved Configuration Manager (almost finished) * Mutex protections for Configuration system * added Configuration storage to p3ConnectMgr. * added Configuration storage to p3MsgService. * bugfixes in p3GeneralConfig. * Added Config Save notification where necessary. * added safe FinalConfigSave before exit(). * added RsPeerNetItem + RsPeerStunItem (serialiser) * reordered startup for correct config loading. * enabled Loading of certs in AuthXPGP. * move sockaddr_clear() to util/rsnet.h * switched p3MsgService sendMessage checking to pqiMonitor syste,. * corrected pqiarchive saving of PeerIds. * added setNetworkMode() & setVisState() to p3ConnectMgr. * added Mutex protection to p3ranking. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@336 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2c69fd7eaf
commit
806b8285f2
36 changed files with 1712 additions and 599 deletions
|
@ -35,6 +35,15 @@
|
|||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
/* RS_VIS_STATE_XXXX
|
||||
* determines how public this peer wants to be...
|
||||
*
|
||||
* STD = advertise to Peers / DHT checking etc
|
||||
* GRAY = share with friends / but not DHT
|
||||
* DARK = hidden from all
|
||||
* BROWN? = hidden from friends / but on DHT
|
||||
*/
|
||||
|
||||
const uint32_t RS_VIS_STATE_NODISC = 0x0001;
|
||||
const uint32_t RS_VIS_STATE_NODHT = 0x0002;
|
||||
|
||||
|
@ -43,6 +52,8 @@ const uint32_t RS_VIS_STATE_GRAY = RS_VIS_STATE_NODHT;
|
|||
const uint32_t RS_VIS_STATE_DARK = RS_VIS_STATE_NODISC | RS_VIS_STATE_NODHT;
|
||||
const uint32_t RS_VIS_STATE_BROWN = RS_VIS_STATE_NODISC;
|
||||
|
||||
|
||||
|
||||
const uint32_t RS_NET_MODE_UNKNOWN = 0x0000;
|
||||
const uint32_t RS_NET_MODE_EXT = 0x0001;
|
||||
const uint32_t RS_NET_MODE_UPNP = 0x0002;
|
||||
|
@ -92,28 +103,21 @@ class peerConnectState
|
|||
peerConnectState(); /* init */
|
||||
|
||||
std::string id;
|
||||
|
||||
uint32_t netMode; /* EXT / UPNP / UDP / INVALID */
|
||||
uint32_t visState; /* STD, GRAY, DARK */
|
||||
|
||||
struct sockaddr_in localaddr, serveraddr;
|
||||
|
||||
time_t lastcontact;
|
||||
|
||||
/***** Below here not stored permanently *****/
|
||||
|
||||
std::string name;
|
||||
|
||||
uint32_t state;
|
||||
uint32_t actions;
|
||||
|
||||
uint32_t netMode; /* EXT / UPNP / UDP / INVALID */
|
||||
|
||||
/* Fix this up! */
|
||||
|
||||
// public for the moment.
|
||||
struct sockaddr_in lastaddr, localaddr, serveraddr;
|
||||
|
||||
/* determines how public this peer wants to be...
|
||||
*
|
||||
* STD = advertise to Peers / DHT checking etc
|
||||
* GRAY = share with friends / but not DHT
|
||||
* DARK = hidden from all
|
||||
* BROWN? = hidden from friends / but on DHT
|
||||
*/
|
||||
|
||||
uint32_t visState; /* STD, GRAY, DARK */
|
||||
|
||||
uint32_t source; /* most current source */
|
||||
peerAddrInfo dht;
|
||||
peerAddrInfo disc;
|
||||
|
@ -125,15 +129,6 @@ class peerConnectState
|
|||
peerConnectAddress currentConnAddr;
|
||||
std::list<peerConnectAddress> connAddrs;
|
||||
|
||||
time_t lastcontact;
|
||||
|
||||
/* stuff here un-used at the moment */
|
||||
|
||||
//time_t c_timestamp; // last connect timestamp
|
||||
//time_t lr_timestamp; // last receive timestamp
|
||||
|
||||
//time_t nc_timestamp; // next connect timestamp.
|
||||
//time_t nc_timeintvl; // next connect time interval.
|
||||
};
|
||||
|
||||
|
||||
|
@ -157,12 +152,17 @@ bool getUPnPState();
|
|||
bool getUPnPEnabled();
|
||||
bool getDHTEnabled();
|
||||
|
||||
void setOwnNetConfig(uint32_t netMode, uint32_t visState);
|
||||
bool setLocalAddress(std::string id, struct sockaddr_in addr);
|
||||
bool setExtAddress(std::string id, struct sockaddr_in addr);
|
||||
|
||||
bool setNetworkMode(std::string id, uint32_t netMode);
|
||||
bool setVisState(std::string id, uint32_t visState);
|
||||
|
||||
/* add/remove friends */
|
||||
bool addFriend(std::string);
|
||||
bool addFriend(std::string id, uint32_t netMode = RS_NET_MODE_UDP,
|
||||
uint32_t visState = RS_VIS_STATE_STD , time_t lastContact = 0);
|
||||
|
||||
bool removeFriend(std::string);
|
||||
bool addNeighbour(std::string);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue