@@ -238,7 +238,7 @@ void DiagnosticsService::loop() {
238238 dtNextTry = -1 ;
239239 }
240240
241- if (retries > 0 && dtNextTry >= 0 ) {
241+ if (retries >= 0 && dtNextTry >= 0 ) {
242242
243243 if (!uploadIssued) {
244244
@@ -261,7 +261,7 @@ void DiagnosticsService::loop() {
261261 uploadFailure = false ;
262262 } else {
263263 MO_DBG_ERR (" cannot upload via FTP. Abort" );
264- retries = 0 ;
264+ retries = - 1 ;
265265 uploadIssued = false ;
266266 uploadFailure = true ;
267267 cleanUploadData ();
@@ -274,7 +274,7 @@ void DiagnosticsService::loop() {
274274 // success!
275275 MO_DBG_DEBUG (" end upload routine (by status)" );
276276 uploadIssued = false ;
277- retries = 0 ;
277+ retries = - 1 ;
278278 cleanUploadData ();
279279 cleanGetLogData ();
280280 }
@@ -303,17 +303,12 @@ void DiagnosticsService::loop() {
303303 // either we have UploadFailed status or (NotUploaded + timeout) here
304304 MO_DBG_WARN (" Upload timeout or failed" );
305305 cleanUploadData ();
306+ uploadIssued = false ;
306307
307- const int TRANSITION_DELAY = 10 ;
308- if (retryInterval <= UPLOAD_TIMEOUT + TRANSITION_DELAY) {
309- nextTry = clock.getUptime ();
310- clock.add (nextTry, TRANSITION_DELAY); // wait for another 10 seconds
311- } else {
312- clock.add (nextTry, retryInterval);
313- }
308+ clock.add (nextTry, retryInterval);
314309 retries--;
315310
316- if (retries == 0 ) {
311+ if (retries < 0 ) {
317312 MO_DBG_DEBUG (" end upload routine (no more retry)" );
318313 uploadFailure = true ;
319314 cleanGetLogData ();
@@ -349,7 +344,7 @@ bool DiagnosticsService::requestDiagnosticsUpload(const char *location, unsigned
349344
350345MO_GetLogStatus DiagnosticsService::getLog (MO_LogType type, int requestId, int retries, unsigned int retryInterval, const char *location, Timestamp oldestTimestamp, Timestamp latestTimestamp, char filenameOut[MO_GETLOG_FNAME_SIZE]) {
351346
352- if (runCustomUpload || this ->retries > 0 ) {
347+ if (runCustomUpload || this ->retries >= 0 ) {
353348 MO_DBG_INFO (" upload still running" );
354349 return MO_GetLogStatus_Rejected;
355350 }
@@ -444,8 +439,8 @@ MO_GetLogStatus DiagnosticsService::getLog(MO_LogType type, int requestId, int r
444439 snprintf (this ->filename , filenameSize, " %s" , filenameOut);
445440
446441 this ->logType = type;
447- this ->retries = retries > 0 ? retries : 1 ;
448- this ->retryInterval = retryInterval > 30 ? retryInterval : 30 ;
442+ this ->retries = retries >= 0 ? retries : 0 ;
443+ this ->retryInterval = retryInterval >= 0 ? retryInterval : 30 ;
449444 this ->oldestTimestamp = oldestTimestamp;
450445 this ->latestTimestamp = latestTimestamp;
451446
@@ -475,7 +470,6 @@ MO_GetLogStatus DiagnosticsService::getLog(MO_LogType type, int requestId, int r
475470#endif
476471
477472 nextTry = clock.now ();
478- clock.add (nextTry, 5 ); // wait for 5s before upload
479473 uploadIssued = false ;
480474 uploadFailure = false ;
481475
@@ -496,7 +490,7 @@ MO_GetLogStatus DiagnosticsService::getLog(MO_LogType type, int requestId, int r
496490}
497491
498492int DiagnosticsService::getRequestId () {
499- if (runCustomUpload || this ->retries > 0 ) {
493+ if (runCustomUpload || this ->retries >= 0 ) {
500494 return requestId;
501495 } else {
502496 return -1 ;
@@ -1000,7 +994,7 @@ void DiagnosticsService::cleanGetLogData() {
1000994 location = nullptr ;
1001995 MO_FREE (filename);
1002996 filename = nullptr ;
1003- retries = 0 ;
997+ retries = - 1 ;
1004998 retryInterval = 0 ;
1005999 oldestTimestamp = Timestamp ();
10061000 latestTimestamp = Timestamp ();
0 commit comments