mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-11 16:13:05 -04:00
Prevent multiple instances from running on Unix systems.
Every call to RsInit::LoadCertificates() now creates a file: ~/.retroshare/xxxxxxxxxxxxxxxxxxxx/lock which is then bound to a system lock (fcntl F_SETLK). If the lock request fails, it means another instance is already running with the same profile. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3241 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
840f077826
commit
fe46d7618a
7 changed files with 221 additions and 47 deletions
|
@ -66,7 +66,7 @@ class RsInit
|
|||
static bool GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &errString);
|
||||
|
||||
/* Login PGP */
|
||||
static bool SelectGPGAccount(std::string id);
|
||||
static bool SelectGPGAccount(const std::string& gpgId);
|
||||
static bool LoadGPGPassword(std::string passwd);
|
||||
|
||||
/* Create SSL Certificates */
|
||||
|
@ -78,8 +78,11 @@ class RsInit
|
|||
/** Final Certificate load. This can be called if:
|
||||
* a) InitRetroshare() returns true -> autoLoad/password Set.
|
||||
* b) SelectGPGAccount() && LoadPassword()
|
||||
*
|
||||
* This wrapper is used to lock the profile first before
|
||||
* finalising the login
|
||||
*/
|
||||
static int LoadCertificates(bool autoLoginNT) ;
|
||||
static int LockAndLoadCertificates(bool autoLoginNT);
|
||||
|
||||
|
||||
/* Post Login Options */
|
||||
|
@ -108,6 +111,12 @@ class RsInit
|
|||
static bool RsStoreAutoLogin() ;
|
||||
static bool RsTryAutoLogin() ;
|
||||
|
||||
/* Lock/unlock profile directory */
|
||||
static int LockConfigDirectory(const std::string& accountDir);
|
||||
static void UnlockConfigDirectory();
|
||||
|
||||
/* The true LoadCertificates() method */
|
||||
static int LoadCertificates(bool autoLoginNT) ;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue