| 1669 | // --------------------------------------------------------------------------- |
| 1670 | |
| 1671 | static double GetNewRetryDelay(int response_code, double dfOldDelay, |
| 1672 | const char *pszErrBuf, |
| 1673 | const char *pszCurlError) { |
| 1674 | if (response_code == 429 || response_code == 500 || |
| 1675 | (response_code >= 502 && response_code <= 504) || |
| 1676 | // S3 sends some client timeout errors as 400 Client Error |
| 1677 | (response_code == 400 && pszErrBuf && |
| 1678 | strstr(pszErrBuf, "RequestTimeout")) || |
| 1679 | (pszCurlError && strstr(pszCurlError, "Connection timed out"))) { |
| 1680 | // Use an exponential backoff factor of 2 plus some random jitter |
| 1681 | // We don't care about cryptographic quality randomness, hence: |
| 1682 | // coverity[dont_call] |
| 1683 | return dfOldDelay * (2 + rand() * 0.5 / RAND_MAX); |
| 1684 | } else { |
| 1685 | return 0; |
| 1686 | } |
| 1687 | } |
| 1688 | |
| 1689 | // --------------------------------------------------------------------------- |
| 1690 |
no outgoing calls
no test coverage detected