mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-23 01:06:17 +00:00
Fixes #46: No more errors while downloading files (with quite large filesize) from Telegram.
This commit is contained in:
parent
88eb7a412c
commit
0db0542d79
@ -1,5 +1,5 @@
|
||||
# Telegram_Backup
|
||||
Copyright 2016 Fabian Schlenz
|
||||
Copyright 2017 Fabian Schlenz
|
||||
Licensed under GPLv3
|
||||
|
||||
## Description
|
||||
@ -59,8 +59,6 @@ amazon.
|
||||
The library I'm using to access Telegram has some small bugs. One of those
|
||||
is the display of meaningless (because they are being acted accordingly upon)
|
||||
error messages. Those include:
|
||||
* `Exception in thread "pool-x-thread-y" java.lang.Error:
|
||||
java.nio.channels.ClosedChannelException`
|
||||
* Something containing `AUTH_ERROR`
|
||||
You can just ignore these messages.
|
||||
|
||||
|
@ -323,7 +323,7 @@ public class DownloadManager {
|
||||
boolean try_again;
|
||||
do {
|
||||
try_again = false;
|
||||
int block_size = size;
|
||||
int block_size = 1024;
|
||||
logger.trace("offset: {} block_size: {} size: {}", offset, block_size, size);
|
||||
TLRequestUploadGetFile req = new TLRequestUploadGetFile(loc, offset, block_size);
|
||||
try {
|
||||
@ -350,7 +350,6 @@ public class DownloadManager {
|
||||
|
||||
fos.write(response.getBytes().getData());
|
||||
fos.flush();
|
||||
try { TimeUnit.MILLISECONDS.sleep(Config.DELAY_AFTER_GET_FILE); } catch(InterruptedException e) {}
|
||||
} while(offset < size && (response.getBytes().getData().length>0 || try_again));
|
||||
fos.close();
|
||||
if (offset < size) {
|
||||
@ -377,6 +376,7 @@ public class DownloadManager {
|
||||
throw last_exception;
|
||||
}
|
||||
last_download_succeeded = true;
|
||||
try { TimeUnit.MILLISECONDS.sleep(Config.DELAY_AFTER_GET_FILE); } catch(InterruptedException e) {}
|
||||
return true;
|
||||
} catch (java.io.IOException ex) {
|
||||
if (fos!=null) fos.close();
|
||||
|
Loading…
Reference in New Issue
Block a user