mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
Retry sending "DID BACKUP" message
This commit is contained in:
parent
29da0923a4
commit
8f683eb72b
@ -2854,6 +2854,34 @@ std::string BackupServerGet::sendClientMessage(const std::string &msg, const std
|
||||
return "";
|
||||
}
|
||||
|
||||
bool BackupServerGet::sendClientMessageRetry(const std::string &msg, const std::string &retok, const std::wstring &errmsg, unsigned int timeout, size_t retry, bool logerr, int max_loglevel, bool *retok_err)
|
||||
{
|
||||
bool res;
|
||||
do
|
||||
{
|
||||
unsigned int starttime=Server->getTimeMS();
|
||||
res = sendClientMessage(msg, retok, errmsg, timeout, logerr, max_loglevel, retok_err);
|
||||
|
||||
if(retry>0)
|
||||
{
|
||||
--retry;
|
||||
unsigned int passed_time=timeout;
|
||||
unsigned int currtime = Server->getTimeMS();
|
||||
if(currtime>starttime)
|
||||
passed_time=currtime-starttime;
|
||||
|
||||
Server->wait(timeout-passed_time);
|
||||
}
|
||||
else
|
||||
{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
while(!res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool BackupServerGet::sendClientMessage(const std::string &msg, const std::string &retok, const std::wstring &errmsg, unsigned int timeout, bool logerr, int max_loglevel, bool *retok_err)
|
||||
{
|
||||
CTCPStack tcpstack(internet_connection);
|
||||
@ -2936,7 +2964,7 @@ void BackupServerGet::stop_shadowcopy(const std::string &path)
|
||||
|
||||
void BackupServerGet::notifyClientBackupSuccessfull(void)
|
||||
{
|
||||
sendClientMessage("DID BACKUP", "OK", L"Sending status (DID BACKUP) to client failed", 10000);
|
||||
sendClientMessageRetry("DID BACKUP", "OK", L"Sending status (DID BACKUP) to client failed", 10000, 5);
|
||||
}
|
||||
|
||||
void BackupServerGet::sendClientBackupIncrIntervall(void)
|
||||
|
||||
@ -41,6 +41,7 @@ public:
|
||||
void operator()(void);
|
||||
|
||||
bool sendClientMessage(const std::string &msg, const std::string &retok, const std::wstring &errmsg, unsigned int timeout, bool logerr=true, int max_loglevel=LL_ERROR, bool *retok_err=NULL);
|
||||
bool sendClientMessageRetry(const std::string &msg, const std::string &retok, const std::wstring &errmsg, unsigned int timeout, size_t retry=0, bool logerr=true, int max_loglevel=LL_ERROR, bool *retok_err=NULL);
|
||||
std::string sendClientMessage(const std::string &msg, const std::wstring &errmsg, unsigned int timeout, bool logerr=true, int max_loglevel=LL_ERROR);
|
||||
void sendToPipe(const std::string &msg);
|
||||
int getPCDone(void);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user