mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 11:02:30 -04:00
* Switched to rsFiles interface for all File Information.
* added TMP p3Files class to interface with old system. * cleaned up old RsControl + RsIface file information. * removed unnecessary functions from RsServer. * Tweaked interfaces for ftServer + ftExtraList. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@630 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6d3c5679c5
commit
be392405e8
14 changed files with 571 additions and 390 deletions
|
@ -41,204 +41,6 @@ const int p3facemsgzone = 11453;
|
|||
/* RsIface Config */
|
||||
/* Config */
|
||||
|
||||
int RsServer::ConfigAddSharedDir( std::string dir )
|
||||
{
|
||||
/* call the server... */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
server -> addSearchDirectory(dir);
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RsServer::ConfigRemoveSharedDir( std::string dir )
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
server -> removeSearchDirectory(dir);
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
int RsServer::ConfigSetIncomingDir( std::string dir )
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
server -> setSaveDir(dir);
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
int RsServer::ConfigSetLocalAddr( std::string ipAddr, int port )
|
||||
{
|
||||
/* check if this is all necessary */
|
||||
struct in_addr inaddr_local;
|
||||
if (0 == inet_aton(ipAddr.c_str(), &inaddr_local))
|
||||
{
|
||||
//bad address - reset.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
/* a little rough and ready, should be moved to the server! */
|
||||
cert *c = sslr -> getOwnCert();
|
||||
|
||||
/* always change the address (checked by sslr->checkNetAddress()) */
|
||||
c -> localaddr.sin_addr = inaddr_local;
|
||||
c -> localaddr.sin_port = htons((short) port);
|
||||
|
||||
sslr -> checkNetAddress();
|
||||
pqih -> restart_listener();
|
||||
sslr -> CertsChanged();
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::ConfigSetExtAddr( std::string ipAddr, int port )
|
||||
{
|
||||
/* check if this is all necessary */
|
||||
struct in_addr inaddr;
|
||||
if (0 == inet_aton(ipAddr.c_str(), &inaddr))
|
||||
{
|
||||
//bad address - reset.
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
/* a little rough and ready, should be moved to the server! */
|
||||
cert *c = sslr -> getOwnCert();
|
||||
|
||||
/* always change the address (checked by sslr->checkNetAddress()) */
|
||||
c -> serveraddr.sin_addr = inaddr;
|
||||
c -> serveraddr.sin_port = htons((short) port);
|
||||
|
||||
sslr -> checkNetAddress();
|
||||
sslr -> CertsChanged();
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int RsServer::ConfigSetLanConfig( bool firewalled, bool forwarded )
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
/* a little rough and ready, should be moved to the server! */
|
||||
cert *c = sslr -> getOwnCert();
|
||||
|
||||
c -> Firewalled(firewalled);
|
||||
c -> Forwarded(forwarded);
|
||||
|
||||
sslr -> checkNetAddress();
|
||||
sslr -> CertsChanged();
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::ConfigSetExtName( std::string addr )
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
/* a little rough and ready, should be moved to the server! */
|
||||
//cert *c = sslr -> getOwnCert();
|
||||
|
||||
/* set the Name here */
|
||||
|
||||
sslr -> checkNetAddress();
|
||||
sslr -> CertsChanged();
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
/* does its own locking */
|
||||
UpdateAllConfig();
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
int RsServer::ConfigSetDataRates( int total, int indiv ) /* in kbrates */
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
|
@ -291,7 +93,6 @@ int RsServer::ConfigSetBootPrompt( bool on )
|
|||
}
|
||||
|
||||
|
||||
|
||||
int RsServer::UpdateAllConfig()
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
|
@ -308,12 +109,6 @@ int RsServer::UpdateAllConfig()
|
|||
peerConnectState pstate;
|
||||
mConnMgr->getOwnNetStatus(pstate);
|
||||
|
||||
/* shared dirs */
|
||||
std::list<std::string> &dirs = server -> getSearchDirectories();
|
||||
config.sharedDirList = dirs;
|
||||
config.incomingDir = server->getSaveDir();
|
||||
|
||||
|
||||
/* ports */
|
||||
config.localAddr = inet_ntoa(pstate.localaddr.sin_addr);
|
||||
config.localPort = ntohs(pstate.localaddr.sin_port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue