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
|
# Telegram_Backup
|
||||||
Copyright 2016 Fabian Schlenz
|
Copyright 2017 Fabian Schlenz
|
||||||
Licensed under GPLv3
|
Licensed under GPLv3
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
@ -59,8 +59,6 @@ amazon.
|
|||||||
The library I'm using to access Telegram has some small bugs. One of those
|
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)
|
is the display of meaningless (because they are being acted accordingly upon)
|
||||||
error messages. Those include:
|
error messages. Those include:
|
||||||
* `Exception in thread "pool-x-thread-y" java.lang.Error:
|
|
||||||
java.nio.channels.ClosedChannelException`
|
|
||||||
* Something containing `AUTH_ERROR`
|
* Something containing `AUTH_ERROR`
|
||||||
You can just ignore these messages.
|
You can just ignore these messages.
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ public class DownloadManager {
|
|||||||
boolean try_again;
|
boolean try_again;
|
||||||
do {
|
do {
|
||||||
try_again = false;
|
try_again = false;
|
||||||
int block_size = size;
|
int block_size = 1024;
|
||||||
logger.trace("offset: {} block_size: {} size: {}", offset, block_size, size);
|
logger.trace("offset: {} block_size: {} size: {}", offset, block_size, size);
|
||||||
TLRequestUploadGetFile req = new TLRequestUploadGetFile(loc, offset, block_size);
|
TLRequestUploadGetFile req = new TLRequestUploadGetFile(loc, offset, block_size);
|
||||||
try {
|
try {
|
||||||
@ -350,7 +350,6 @@ public class DownloadManager {
|
|||||||
|
|
||||||
fos.write(response.getBytes().getData());
|
fos.write(response.getBytes().getData());
|
||||||
fos.flush();
|
fos.flush();
|
||||||
try { TimeUnit.MILLISECONDS.sleep(Config.DELAY_AFTER_GET_FILE); } catch(InterruptedException e) {}
|
|
||||||
} while(offset < size && (response.getBytes().getData().length>0 || try_again));
|
} while(offset < size && (response.getBytes().getData().length>0 || try_again));
|
||||||
fos.close();
|
fos.close();
|
||||||
if (offset < size) {
|
if (offset < size) {
|
||||||
@ -377,6 +376,7 @@ public class DownloadManager {
|
|||||||
throw last_exception;
|
throw last_exception;
|
||||||
}
|
}
|
||||||
last_download_succeeded = true;
|
last_download_succeeded = true;
|
||||||
|
try { TimeUnit.MILLISECONDS.sleep(Config.DELAY_AFTER_GET_FILE); } catch(InterruptedException e) {}
|
||||||
return true;
|
return true;
|
||||||
} catch (java.io.IOException ex) {
|
} catch (java.io.IOException ex) {
|
||||||
if (fos!=null) fos.close();
|
if (fos!=null) fos.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user