Fixed network down recovery

This patch fixes chunk size calculation during network down retries and prevents library from flooding with upload requests.