Fixed a lot of memory leaks

This commit is contained in:
Martin 2012-08-14 22:14:11 +02:00
parent b2a4190f2b
commit ead65048dd
31 changed files with 307 additions and 60 deletions

View File

@ -143,6 +143,8 @@ public:
virtual bool attachToDatabase(const std::string &pFile, const std::string &pName, DATABASE_ID pIdentifier)=0;
virtual void waitForStartupComplete(void)=0;
virtual void shutdown(void)=0;
};
#ifndef NO_INTERFACE

View File

@ -79,7 +79,9 @@
# include <pwd.h>
#endif
const size_t SEND_BLOCKSIZE=8192;
const size_t SEND_BLOCKSIZE=8192;
extern bool run;
CServer::CServer()
{
@ -1144,7 +1146,8 @@ void CServer::createThread(IThread *thread)
#else
pthread_t t;
pthread_create(&t, NULL, &thread_helper_f, (void*)thread);
pthread_create(&t, NULL, &thread_helper_f, (void*)thread);
pthread_detach(t);
#endif
#endif //THREAD_BOOST
}
@ -1501,4 +1504,10 @@ void CServer::startupComplete(void)
IPipeThrottler* CServer::createPipeThrottler(size_t bps)
{
return new PipeThrottler(bps);
}
}
void CServer::shutdown(void)
{
run=false;
}

View File

@ -156,6 +156,8 @@ public:
virtual void waitForStartupComplete(void);
void startupComplete(void);
void shutdown(void);
private:
bool UnloadDLLs(void);

View File

@ -21,8 +21,13 @@
#include <dlfcn.h>
bool CServer::LoadDLL(const std::string &name)
{
HMODULE dll = dlopen( name.c_str(), RTLD_NOW | RTLD_GLOBAL);
{
int mode=RTLD_NOW | RTLD_GLOBAL;
if(getServerParameter("leak_check")=="true")
{
mode|=RTLD_NODELETE;
}
HMODULE dll = dlopen( name.c_str(), mode);
if(dll==NULL)
{
@ -56,4 +61,4 @@ void CServer::UnloadDLLs2(void)
int CServer::WriteDump(void* pExceptionPointers)
{
}
}

View File

@ -116,7 +116,9 @@ CServiceAcceptor::~CServiceAcceptor()
for(size_t i=0;i<workers.size();++i)
{
delete workers[i];
}
}
delete service;
}
void CServiceAcceptor::operator()(void)
@ -137,8 +139,10 @@ void CServiceAcceptor::operator()(void)
#ifndef _WIN32
FD_SET(xpipe[0], &fdset);
if(xpipe[0]>maxs)
maxs=xpipe[0]+1;
maxs=xpipe[0];
#endif
++maxs;
timeval lon;

View File

@ -36,6 +36,10 @@ CServiceWorker::~CServiceWorker()
delete clients[i].second;
}
clients.clear();
Server->destroy(mutex);
Server->destroy(nc_mutex);
Server->destroy(cond);
}
void CServiceWorker::stop(void)

View File

@ -1,9 +1,10 @@
#include "../Interface/Types.h"
#include "../Interface/Thread.h"
#include "../Interface/Object.h"
class IPipe;
class CHTTPAction : public IThread
class CHTTPAction : public IThread, public IObject
{
public:
CHTTPAction(const std::wstring &pName, const std::wstring pContext, const std::string &pGETStr, const std::string pPOSTStr, const str_nmap &pRawPARAMS, IPipe *pOutput);
@ -19,4 +20,4 @@ private:
IPipe *output;
};
};

View File

@ -62,6 +62,11 @@ void CHTTPClient::init_mutex(void)
share_mutex=Server->createMutex();
}
void CHTTPClient::destroy_mutex(void)
{
Server->destroy(share_mutex);
}
void CHTTPClient::ReceivePackets(void)
{
std::string data;
@ -113,13 +118,25 @@ bool CHTTPClient::Run(void)
{
if( Server->getThreadPool()->isRunning(request_ticket)==false )
{
//Server->Log("Connection: "+http_params["CONNECTION"], LL_DEBUG);
if( strlower(http_params["CONNECTION"])=="close" )
{
http_g_state=HTTP_STATE_DONE;
}
else
{
http_g_state=HTTP_STATE_KEEPALIVE;
http_keepalive_start=Server->getTimeMS();
http_keepalive_count=std::min(atoi(http_params["KEEP-ALIVE"].c_str()), HTTP_MAX_KEEPALIVE );
//Server->Log("Keep-alive: "+http_params["KEEP-ALIVE"], LL_DEBUG);
str_nmap::iterator iter=http_params.find("KEEP-ALIVE");
if(iter==http_params.end())
{
http_keepalive_count=HTTP_MAX_KEEPALIVE;
}
else
{
http_keepalive_count=std::min(atoi(iter->second.c_str()), HTTP_MAX_KEEPALIVE );
}
}
if(fileupload)
{
@ -468,8 +485,9 @@ bool CHTTPClient::processRequest(void)
}
else
{
request_handler=new CHTTPProxy(http_method, http_query, http_version, http_content, http_params, pipe, NULL, NULL);
request_ticket=Server->getThreadPool()->execute(request_handler);
CHTTPProxy *proxy_handler=new CHTTPProxy(http_method, http_query, http_version, http_content, http_params, pipe, NULL, NULL);
request_ticket=Server->getThreadPool()->execute(proxy_handler);
request_handler=proxy_handler;
}
return true;
}
@ -515,15 +533,19 @@ bool CHTTPClient::processRequest(void)
if( path[i]!=".." && path[i]!="." )
rp+="/"+path[i];
}
request_handler=new CHTTPFile(http_service->getRoot()+rp, pipe);
request_ticket=Server->getThreadPool()->execute(request_handler);
CHTTPFile *file_handler=new CHTTPFile(http_service->getRoot()+rp, pipe);
request_ticket=Server->getThreadPool()->execute(file_handler);
request_handler=file_handler;
return true;
}
std::string gparams=getafter("?", *pl);
request_handler=new CHTTPAction(widen(name),widen(context),gparams, http_content, http_params, pipe);
request_ticket=Server->getThreadPool()->execute(request_handler);
pl=NULL;
CHTTPAction *action_handler=new CHTTPAction(widen(name),widen(context),gparams, http_content, http_params, pipe);
request_ticket=Server->getThreadPool()->execute(action_handler);
request_handler=action_handler;
return true;
}
else

View File

@ -26,6 +26,7 @@ public:
virtual bool Run(void);
static void init_mutex(void);
static void destroy_mutex(void);
private:
@ -57,7 +58,7 @@ private:
int request_num;
IThread *request_handler;
IObject *request_handler;
THREADPOOL_TICKET request_ticket;
POSTFILE_KEY pfilekey;

View File

@ -1,10 +1,11 @@
#include "../Interface/Thread.h"
#include "../Interface/Object.h"
#include <string>
class IPipe;
class CHTTPFile : public IThread
class CHTTPFile : public IThread, public IObject
{
public:
CHTTPFile(std::string pFilename, IPipe *pOutput);
@ -15,4 +16,4 @@ public:
private:
std::string filename;
IPipe *output;
};
};

View File

@ -1,6 +1,6 @@
#include "../Interface/Types.h"
#include "../Interface/Thread.h"
#include "../Interface/Object.h"
#include <string>
#include <queue>
@ -16,7 +16,7 @@ struct CBuffer
int offset;
};
class CHTTPProxy : public IThread
class CHTTPProxy : public IThread, public IObject
{
public:
CHTTPProxy(std::string pHttp_method, std::string pHttp_query, int pHttp_version, const std::string pPOSTStr, const str_nmap &pRawPARAMS, IPipe *pOutput, IPipe *pNotify, IPipe *pTimeoutPipe);
@ -36,4 +36,4 @@ private:
std::vector<IPipe*> output;
std::vector<int> sync;
std::vector< std::queue<CBuffer> > output_buffer;
};
};

View File

@ -92,5 +92,8 @@ DLLEXPORT void LoadActions(IServer* pServer)
DLLEXPORT void UnloadActions(void)
{
//delete http_service;
if(Server->getServerParameter("leak_check")=="true")
{
CHTTPClient::destroy_mutex();
}
}

View File

@ -231,9 +231,9 @@ int main_fkt(int argc, char *argv[])
if( carg[1]=='-' && carg.size()>2 )
p=carg.substr(2, carg.size()-2);
else
p=carg.substr(1, carg.size()-1);
std::string v="true";
p=carg.substr(1, carg.size()-1);
std::string v;
if( narg.size()>0 && narg[0]!='-' )
{
@ -247,6 +247,10 @@ int main_fkt(int argc, char *argv[])
{
v=p.substr(g+1);
p=p.substr(0,g);
}
else
{
v="true";
}
}
@ -571,4 +575,4 @@ int main(int argc, char *argv[])
service.start();
}
}
#endif
#endif

View File

@ -334,6 +334,11 @@ void InternetServiceConnector::init_mutex(void)
mutex=Server->createMutex();
}
void InternetServiceConnector::destroy_mutex(void)
{
Server->destroy(mutex);
}
IPipe *InternetServiceConnector::getConnection(const std::string &clientname, char service, int timeoutms)
{
@ -549,4 +554,4 @@ void InternetServiceConnector::localWait(ICondition *cond, int timems)
{
IScopedLock lock(local_mutex);
cond->wait(&lock, timems);
}
}

View File

@ -48,6 +48,7 @@ public:
virtual void ReceivePackets(void);
static void init_mutex(void);
static void destroy_mutex(void);
static IPipe *getConnection(const std::string &clientname, char service, int timeoutms=-1);
static std::vector<std::string> getOnlineClients(void);
@ -103,4 +104,4 @@ private:
std::string authkey;
int compression_level;
};
};

View File

@ -1,5 +1,5 @@
lib_LTLIBRARIES = liburbackupserver.la
liburbackupserver_la_SOURCES = dllmain.cpp ../stringtools.cpp ../urbackupcommon/os_functions_lin.cpp server.cpp server_get.cpp server_hash.cpp server_image.cpp ../urbackupcommon/sha2/sha2.c ../urbackupcommon/fileclient/data.cpp fileclient/FileClient.cpp ../urbackupcommon/fileclient/tcpstack.cpp server_prepare_hash.cpp server_update.cpp server_status.cpp server_channel.cpp server_ping.cpp server_log.cpp ../urbackupcommon/escape.cpp server_writer.cpp ../urbackupcommon/bufmgr.cpp server_running.cpp server_cleanup.cpp server_settings.cpp server_update_stats.cpp serverinterface/helper.cpp serverinterface/json.cpp serverinterface/lastacts.cpp serverinterface/login.cpp serverinterface/progress.cpp serverinterface/salt.cpp serverinterface/templ.cpp serverinterface/users.cpp serverinterface/piegraph.cpp serverinterface/usage.cpp serverinterface/usagegraph.cpp serverinterface/status.cpp serverinterface/settings.cpp serverinterface/backups.cpp serverinterface/logs.cpp serverinterface/isimageready.cpp serverinterface/getimage.cpp serverinterface/google_chart.cpp treediff/TreeDiff.cpp treediff/TreeNode.cpp treediff/TreeReader.cpp ChunkPatcher.cpp ../urbackupcommon/CompressedPipe.cpp InternetServiceConnector.cpp ../urbackupcommon/InternetServicePipe.cpp ../md5.cpp ../urbackupcommon/settingslist.cpp fileclient/FileClientChunked.cpp ../urbackupcommon/adler32.cpp server_archive.cpp filedownload.cpp
liburbackupserver_la_SOURCES = dllmain.cpp ../stringtools.cpp ../urbackupcommon/os_functions_lin.cpp server.cpp server_get.cpp server_hash.cpp server_image.cpp ../urbackupcommon/sha2/sha2.c ../urbackupcommon/fileclient/data.cpp fileclient/FileClient.cpp ../urbackupcommon/fileclient/tcpstack.cpp server_prepare_hash.cpp server_update.cpp server_status.cpp server_channel.cpp server_ping.cpp server_log.cpp ../urbackupcommon/escape.cpp server_writer.cpp ../urbackupcommon/bufmgr.cpp server_running.cpp server_cleanup.cpp server_settings.cpp server_update_stats.cpp serverinterface/helper.cpp serverinterface/json.cpp serverinterface/lastacts.cpp serverinterface/login.cpp serverinterface/progress.cpp serverinterface/salt.cpp serverinterface/templ.cpp serverinterface/users.cpp serverinterface/piegraph.cpp serverinterface/usage.cpp serverinterface/usagegraph.cpp serverinterface/status.cpp serverinterface/settings.cpp serverinterface/backups.cpp serverinterface/logs.cpp serverinterface/isimageready.cpp serverinterface/getimage.cpp serverinterface/google_chart.cpp treediff/TreeDiff.cpp treediff/TreeNode.cpp treediff/TreeReader.cpp ChunkPatcher.cpp ../urbackupcommon/CompressedPipe.cpp InternetServiceConnector.cpp ../urbackupcommon/InternetServicePipe.cpp ../md5.cpp ../urbackupcommon/settingslist.cpp fileclient/FileClientChunked.cpp ../urbackupcommon/adler32.cpp server_archive.cpp filedownload.cpp serverinterface/shutdown.cpp
AM_CXXFLAGS = -DLINUX
INSTALL_OPTS=-o urbackup -g urbackup
install-data-local: backup_server.db ../urbackup/status.htm ../urbackup/google_chart.js www/*.js www/*.htm www/*.css $(srcdir)/www/*.png www/*.gif

View File

@ -85,6 +85,7 @@ const unsigned short serviceport=35623;
std::vector<IAction*> gActions;
void init_mutex1(void);
void destroy_mutex1(void);
void writeZeroblockdata(void);
bool testEscape(void);
void upgrade(void);
@ -95,6 +96,10 @@ std::string lang="en";
std::string time_format_str_de="%d.%m.%Y %H:%M";
std::string time_format_str="%Y-%m-%d %H:%M";
THREADPOOL_TICKET tt_cleanup_thread;
THREADPOOL_TICKET tt_automatic_archive_thread;
bool is_leak_check=false;
#ifdef _WIN32
const std::string new_file="new.txt";
#else
@ -411,6 +416,11 @@ DLLEXPORT void LoadActions(IServer* pServer)
ADD_ACTION(isimageready);
ADD_ACTION(getimage);
if(Server->getServerParameter("allow_shutdown")=="true")
{
ADD_ACTION(shutdown);
}
Server->Log("Started UrBackup...", LL_INFO);
@ -462,24 +472,39 @@ DLLEXPORT void LoadActions(IServer* pServer)
}
ServerCleanupThread::initMutex();
ServerAutomaticArchive::initMutex();
ServerCleanupThread *server_cleanup=new ServerCleanupThread();
Server->createThread(server_cleanup);
Server->createThread(new ServerAutomaticArchive);
is_leak_check=(Server->getServerParameter("leak_check")=="true");
if(is_leak_check)
{
tt_cleanup_thread=Server->getThreadPool()->execute(server_cleanup);
tt_automatic_archive_thread=Server->getThreadPool()->execute(new ServerAutomaticArchive);
}
else
{
Server->createThread(server_cleanup);
Server->createThread(new ServerAutomaticArchive);
}
Server->Log("UrBackup Server start up complete.", LL_INFO);
}
DLLEXPORT void UnloadActions(void)
{
int wtime=500;
if(is_leak_check)
wtime=2000;
bool shutdown_ok=false;
if(server_exit_pipe!=NULL)
{
std::string msg="exit";
unsigned int starttime=Server->getTimeMS();
while(msg!="ok" && Server->getTimeMS()-starttime<500)
while(msg!="ok" && Server->getTimeMS()-starttime<wtime)
{
server_exit_pipe->Write(msg);
server_exit_pipe->Write("exit");
Server->wait(100);
server_exit_pipe->Read(&msg);
}
@ -487,13 +512,43 @@ DLLEXPORT void UnloadActions(void)
if(msg=="ok")
{
Server->destroy(server_exit_pipe);
BackupServer::cleanupThrottlers();
shutdown_ok=true;
}
}
ServerLogger::destroy_mutex();
BackupServerGet::destroy_mutex();
if(is_leak_check)
{
std::vector<THREADPOOL_TICKET> tickets;
tickets.push_back(tt_automatic_archive_thread);
tickets.push_back(tt_cleanup_thread);
ServerCleanupThread::doQuit();
ServerAutomaticArchive::doQuit();
Server->getThreadPool()->waitFor(tickets);
ServerCleanupThread::destroyMutex();
ServerAutomaticArchive::destroyMutex();
if(!shutdown_ok)
{
Server->Log("Could not shut down server. Leaks expected.", LL_ERROR);
}
InternetServiceConnector::destroy_mutex();
destroy_mutex1();
Server->destroy(startup_status.mutex);
ServerSettings::destroy_mutex();
ServerStatus::destroy_mutex();
}
if(shutdown_ok)
{
BackupServerGet::destroy_mutex();
}
IDatabase *db=Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER);
db->Write("PRAGMA wal_checkpoint");
@ -947,4 +1002,4 @@ void upgrade(void)
}
db->destroyAllQueries();
}
}

View File

@ -43,11 +43,15 @@ BackupServer::BackupServer(IPipe *pExitpipe)
{
throttle_mutex=Server->createMutex();
exitpipe=pExitpipe;
}
BackupServer::~BackupServer()
{
Server->destroy(throttle_mutex);
}
void BackupServer::operator()(void)
{
Server->wait(5000);
IDatabase *db=Server->getDatabase(Server->getThreadID(),URBACKUPDB_SERVER);
ISettingsReader *settings=Server->createDBSettingsReader(Server->getDatabase(Server->getThreadID(),URBACKUPDB_SERVER), "settings_db.settings");
@ -371,7 +375,18 @@ IPipeThrottler *BackupServer::getGlobalLocalThrottler(size_t speed_bps)
global_local_throttler->changeThrottleLimit(speed_bps);
}
return global_local_throttler;
}
void BackupServer::cleanupThrottlers(void)
{
if(global_internet_throttler!=NULL)
{
Server->destroy(global_internet_throttler);
}
if(global_local_throttler!=NULL)
{
Server->destroy(global_local_throttler);
}
}
#endif //CLIENT_ONLY
#endif //CLIENT_ONLY

View File

@ -21,12 +21,15 @@ struct SClient
class BackupServer : public IThread
{
public:
BackupServer(IPipe *pExitpipe);
BackupServer(IPipe *pExitpipe);
~BackupServer();
void operator()(void);
static IPipeThrottler *getGlobalInternetThrottler(size_t speed_bps);
static IPipeThrottler *getGlobalLocalThrottler(size_t speed_bps);
static IPipeThrottler *getGlobalLocalThrottler(size_t speed_bps);
static void cleanupThrottlers(void);
private:
void findClients(FileClient &fc);
@ -45,4 +48,4 @@ private:
static IMutex *throttle_mutex;
};
#endif //URB_SERVER_H
#endif //URB_SERVER_H

View File

@ -6,6 +6,10 @@
#include "../urbackupcommon/os_functions.h"
#include <algorithm>
ICondition *ServerAutomaticArchive::cond=NULL;
IMutex *ServerAutomaticArchive::mutex=NULL;
volatile bool ServerAutomaticArchive::do_quit=false;
void ServerAutomaticArchive::operator()(void)
{
Server->waitForStartupComplete();
@ -13,12 +17,15 @@ void ServerAutomaticArchive::operator()(void)
db=Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER);
while(true)
while(!do_quit)
{
archiveTimeout();
archiveBackups();
Server->wait(60*60*1000);
IScopedLock lock(mutex);
cond->wait(&lock, 60*60*1000);
}
delete this;
}
void ServerAutomaticArchive::archiveTimeout(void)
@ -311,4 +318,23 @@ bool ServerAutomaticArchive::isInArchiveWindow(const std::wstring &window_def)
}
return true;
}
}
void ServerAutomaticArchive::doQuit(void)
{
do_quit=true;
IScopedLock lock(mutex);
cond->notify_all();
}
void ServerAutomaticArchive::initMutex(void)
{
mutex=Server->createMutex();
cond=Server->createCondition();
}
void ServerAutomaticArchive::destroyMutex(void)
{
Server->destroy(mutex);
Server->destroy(cond);
}

View File

@ -1,6 +1,8 @@
#include <string>
#include "../Interface/Thread.h"
#include "../Interface/Mutex.h"
#include "../Interface/Condition.h"
class IDatabase;
@ -15,6 +17,9 @@ public:
static int getBackupTypes(const std::wstring &backup_type_name);
static std::wstring getBackupType(int backup_types);
static void doQuit(void);
static void initMutex(void);
static void destroyMutex(void);
private:
void archiveTimeout(void);
@ -28,4 +33,8 @@ private:
void copyArchiveSettings(int clientid);
IDatabase *db;
};
static volatile bool do_quit;
static ICondition *cond;
static IMutex *mutex;
};

View File

@ -36,7 +36,8 @@ IMutex *ServerCleanupThread::mutex=NULL;
ICondition *ServerCleanupThread::cond=NULL;
bool ServerCleanupThread::update_stats=false;
IMutex *ServerCleanupThread::a_mutex=NULL;
bool ServerCleanupThread::update_stats_interruptible=false;
bool ServerCleanupThread::update_stats_interruptible=false;
volatile bool ServerCleanupThread::do_quit=false;
const unsigned int min_cleanup_interval=12*60*60;
@ -45,12 +46,30 @@ void ServerCleanupThread::initMutex(void)
mutex=Server->createMutex();
cond=Server->createCondition();
a_mutex=Server->createMutex();
}
void ServerCleanupThread::destroyMutex(void)
{
Server->destroy(mutex);
Server->destroy(cond);
Server->destroy(a_mutex);
}
void ServerCleanupThread::operator()(void)
{
db=Server->getDatabase(Server->getThreadID(), URBACKUPDB_SERVER);
unsigned int last_cleanup=0;
unsigned int last_cleanup=0;
{
IScopedLock lock(mutex);
cond->wait(&lock, 60000);
if(do_quit)
{
delete this;
return;
}
}
{
ScopedActiveThread sat;
@ -84,6 +103,10 @@ void ServerCleanupThread::operator()(void)
if(!update_stats)
{
cond->wait(&lock, 3600000);
}
if(do_quit)
{
return;
}
if(update_stats)
{
@ -139,7 +162,9 @@ void ServerCleanupThread::operator()(void)
last_cleanup=Server->getTimeSeconds();
}
}
}
}
delete this;
}
void ServerCleanupThread::updateStats(bool interruptible)
@ -985,6 +1010,12 @@ void ServerCleanupThread::backup_database(void)
Server->deleteFile(bfolder+os_file_sep()+L"backup_server_settings.db~");
}
}
}
void ServerCleanupThread::doQuit(void)
{
do_quit=true;
cond->notify_all();
}
#endif //CLIENT_ONLY
#endif //CLIENT_ONLY

View File

@ -39,8 +39,11 @@ public:
static void updateStats(bool interruptible);
static void initMutex(void);
static void destroyMutex(void);
void backup_database(void);
static void doQuit(void);
private:
void removeImageSize(int backupid);
@ -84,5 +87,7 @@ private:
static bool update_stats;
static bool update_stats_interruptible;
std::vector<int> removeerr;
};
std::vector<int> removeerr;
static volatile bool do_quit;
};

View File

@ -171,6 +171,7 @@ void BackupServerGet::operator ()(void)
pipe->Write("ok");
Server->Log(L"server_get Thread for client \""+clientname+L"\" finished and the identity was not recognized", LL_INFO);
cleanup_pipes();
delete this;
return;
}
@ -196,6 +197,7 @@ void BackupServerGet::operator ()(void)
pipe->Write("ok");
Server->Log(L"server_get Thread for client "+clientname+L" finished, restore thread");
cleanup_pipes();
delete this;
return;
}
@ -238,6 +240,7 @@ void BackupServerGet::operator ()(void)
ServerStatus::setTooManyClients(clientname, true);
ServerLogger::reset(clientid);
delete server_settings;
cleanup_pipes();
delete this;
return;
}
@ -253,6 +256,7 @@ void BackupServerGet::operator ()(void)
Server->Log(L"Could not create or read directory for client \""+clientname+L"\"", LL_ERROR);
pipe->Write("ok");
delete server_settings;
cleanup_pipes();
delete this;
return;
}
@ -266,6 +270,7 @@ void BackupServerGet::operator ()(void)
Server->Log(L"Could not get client capabilities", LL_ERROR);
pipe->Write("ok");
delete server_settings;
cleanup_pipes();
delete this;
return;
}
@ -680,6 +685,9 @@ void BackupServerGet::operator ()(void)
std::string msg;
exitpipe_prepare->Read(&msg);
Server->destroy(exitpipe_prepare);
Server->destroy(hashpipe_prepare);
Server->destroy(hashpipe);
}
else
{
@ -3150,4 +3158,12 @@ IPipe * BackupServerGet::new_fileclient_connection(void)
return rp;
}
#endif //CLIENT_ONLY
void BackupServerGet::cleanup_pipes(void)
{
Server->destroy(hashpipe);
Server->destroy(hashpipe_prepare);
Server->destroy(exitpipe);
Server->destroy(exitpipe_prepare);
}
#endif //CLIENT_ONLY

View File

@ -132,6 +132,8 @@ private:
IPipeThrottler *getThrottler(size_t speed_bps);
void cleanup_pipes(void);
IPipe *pipe;
IDatabase *db;

View File

@ -43,6 +43,11 @@ void init_mutex1(void)
delete_mutex=Server->createMutex();
}
void destroy_mutex1(void)
{
Server->destroy(delete_mutex);
}
BackupServerHash::BackupServerHash(IPipe *pPipe, IPipe *pExitpipe, int pClientid)
{
pipe=pPipe;
@ -792,4 +797,4 @@ bool BackupServerHash::patchFile(IFile *patch, const std::wstring &source, const
return true;
}
#endif //CLIENT_ONLY
#endif //CLIENT_ONLY

View File

@ -33,6 +33,14 @@ void ServerSettings::init_mutex(void)
g_mutex=Server->createMutex();
}
void ServerSettings::destroy_mutex(void)
{
if(g_mutex!=NULL)
{
Server->destroy(g_mutex);
}
}
ServerSettings::ServerSettings(IDatabase *db, int pClientid) : clientid(pClientid)
{
{
@ -457,4 +465,4 @@ std::string ServerSettings::generateRandomAuthKey(void)
return key;
}
#endif //CLIENT_ONLY
#endif //CLIENT_ONLY

View File

@ -83,6 +83,7 @@ public:
SSettings *getSettings(bool *was_updated=NULL);
static void init_mutex(void);
static void destroy_mutex(void);
static void updateAll(void);
static std::string generateRandomAuthKey(void);
@ -113,4 +114,4 @@ private:
std::vector<std::wstring> getSettingsList(void);
#endif //SERVER_SETTINS_H
#endif //SERVER_SETTINS_H

View File

@ -33,6 +33,11 @@ void ServerStatus::init_mutex(void)
{
mutex=Server->createMutex();
last_status_update=Server->getTimeMS();
}
void ServerStatus::destroy_mutex(void)
{
Server->destroy(mutex);
}
void ServerStatus::setServerStatus(const SStatus &pStatus, bool setactive)
@ -239,4 +244,4 @@ ACTION_IMPL(server_status)
Server->destroy(tmpl);
}
#endif //CLIENT_ONLY
#endif //CLIENT_ONLY

View File

@ -59,6 +59,7 @@ public:
static bool isBackupStopped(const std::wstring &clientname);
static void init_mutex(void);
static void destroy_mutex(void);
static std::vector<SStatus> getStatus(void);
static SStatus getStatus(const std::wstring &clientname);
@ -113,4 +114,4 @@ private:
THREADPOOL_TICKET at_ticket;
};
#endif //SERVERSTATUS_H
#endif //SERVERSTATUS_H

View File

@ -18,4 +18,5 @@ namespace Actions
ACTION(isimageready);
ACTION(getimage);
ACTION(google_chart);
}
ACTION(shutdown);
}