Commit Graph

533 Commits

Author SHA1 Message Date
Andrey Egorov
7c0af2c080 Another attempt to prevent duplicates 2017-12-09 21:24:13 +03:00
Andrey Egorov
984f483b98 Handle updates and other refactoring 2017-12-03 02:31:43 +03:00
Andrey Egorov
004c92edbe SocketClosed exception 2017-11-19 13:04:40 +03:00
Andrey Egorov
32bca4f1b8 Refactoring of TcpClient 2017-11-19 01:55:40 +03:00
Andrey Egorov
653dd21259 Socket OSError logging 2017-11-16 17:31:39 +03:00
Andrey Egorov
2efcfbd416 More aggressive catching network errors 2017-11-16 02:56:57 +03:00
Andrey Egorov
3111153822 No route to host catched + other errno to reconnect 2017-11-15 14:19:01 +03:00
Andrey Egorov
25af22f1e7 Bugfix in reconnection 2017-11-14 14:07:40 +03:00
Andrey Egorov
5e172053da Merge remote-tracking branch 'upstream/asyncio' into asyncio 2017-10-30 00:29:46 +03:00
Lonami Exo
23b5a9d1f6 Merge branch 'master' into asyncio 2017-10-29 20:08:32 +01:00
Andrey Egorov
cb2d943139 Remove forgotten points 2017-10-29 15:33:03 +03:00
Lonami Exo
e48f15be80 Fix-up af08d59 (missing parenthesis) 2017-10-28 11:11:51 +02:00
Tanuj
af08d59cb7 Fix bug with semicolons when downloading contacts (#319) 2017-10-28 11:09:46 +02:00
Lonami Exo
c6d30ffceb Fix exception when logging exceptions 2017-10-25 13:06:51 +02:00
Lonami Exo
3db13ccdd2 Add a more descriptive error when serializing bytes 2017-10-25 12:43:57 +02:00
Lonami Exo
ceb37cd4c5 Move auth_key generation and InitConnection logic to .invoke()
The reasoning behind this is that .connect() should not call
any request at all, it should only connect to the servers
although it currently still calls GetStateRequest.

There were some issues (#291, #360) where the auth_key was None
(possibly due to .connect() returning False), so this may
fix some of the cases where it returned False. This way we also
ensure that we always have an auth_key, or even if it "breaks"
(it's not the right key for the server anymore).

A few additional changes have been introduced to accommodate
this, such as moving InitConnection logic too or importing auths.
2017-10-24 15:40:51 +02:00
Lonami Exo
d58c729af0 Add missing InputPeerSelf case to .get_input_user 2017-10-24 09:43:59 +02:00
Lonami Exo
8bd578711c Revert "no more retries" exception 2017-10-23 10:05:15 +02:00
Lonami Exo
3a7fa249a4 Revert None result checks on the TelegramClient 2017-10-22 20:30:55 +02:00
Lonami Exo
48ec0319d2 Merge branch 'asyncio' of LonamiWebs/Telethon into asyncio 2017-10-22 20:10:25 +02:00
Lonami Exo
ffaa3ac064 Remove unused timeout variable from the TelegramClient 2017-10-22 19:47:24 +02:00
Lonami Exo
30ac6789ce Change _set_connected_and_authorized condition 2017-10-22 19:27:49 +02:00
Lonami Exo
1a0d5e75bf Make use of more constants in the TcpClient 2017-10-22 19:13:45 +02:00
Andrey Egorov
780e0ceddf Update handlers works; it also seems stable 2017-10-22 15:06:36 +03:00
Lonami Exo
b04eed82eb Add new .idle() method to listen for updates from MainThread 2017-10-22 13:16:34 +02:00
Andrey Egorov
8057cea294 Fix resending requests on bad salt/msg notification (#369)
These responses from the server could indicate container IDs,
which weren't being saved. This fix also accounts for that case.
2017-10-22 13:13:49 +02:00
Lonami Exo
5de8350d85 Reorder another import for #357 2017-10-22 11:23:15 +02:00
Lonami Exo
6759beac21 Add __str__ methods to TLMessage and MessageContainer 2017-10-21 20:23:53 +02:00
Lonami Exo
d7f917ebfc Update docstrings 2017-10-21 16:59:20 +02:00
Lonami Exo
335bc6a789 Merge branch 'master' into asyncio 2017-10-21 15:45:56 +02:00
Lonami Exo
7596f2b797 Fix and enhance "no workers set" warning 2017-10-21 13:48:57 +02:00
Lonami Exo
5cdf92e509 Update to v0.15.3 2017-10-20 23:33:08 +02:00
Lonami Exo
d70811b693 Fix infinite loop when invoking on update handlers (fix #336)
Every update that hadn't been acknowledged on the main connection
yet would be resent on any new connection. These new connections
are made temporary when invoking anything from any thread that's
not the main thread. It would also process all the updates, hence,
Telegram would be resending these not-acknowledged updates to the
temporary connection, and the updates would be processed again,
then the update handler would react to the duplicated updates over
and over.

To fix this, simply don't process updates on the temporary thread
at all. With this reasoning, if we don't acknowledge updates on
the temporary connections, Telegram will resend them on the main
connection, so we should not lose any.
2017-10-20 23:30:02 +02:00
Lonami Exo
2782a08ed0 Add note for future self when handling gzip packed data 2017-10-20 22:44:00 +02:00
Lonami Exo
1a91c024fc Revert 63dfb1e as many updates were being dropped 2017-10-20 22:12:03 +02:00
Lonami Exo
033119e9b8 Make MtProtoSender._need_confirmation a set
This will avoid adding duplicated items to it
2017-10-20 22:07:45 +02:00
Lonami Exo
38ccd6d1d9 Generate errors from PWRTelegram's API 2017-10-20 17:20:05 +02:00
Andrey Egorov
f37b9ed20e Fix new salt not being saved to session file (#362) 2017-10-20 16:48:54 +02:00
Lonami Exo
e4bcab336b Fix some missing await calls 2017-10-20 16:05:49 +02:00
Andrey Egorov
050cd95d32 Remove unnecessary .disconnect() from ._invoke() (#356) 2017-10-19 10:51:34 +02:00
Andrey Egorov
e349910eb9 Fix attribute access order being swapped (#353) 2017-10-18 15:34:04 +02:00
Andrey Egorov
16cf94c9ad Fix ._clear_all_pending failing due to a wrong call (#352) 2017-10-18 14:47:03 +02:00
Lonami Exo
87dc476dae Fix ReadThread not starting on reconnect if already authorized 2017-10-18 14:45:08 +02:00
Lonami Exo
5a1074dc7c Avoid calling .sync_updates when not needed 2017-10-18 12:17:13 +02:00
Lonami Exo
adb79b21cf Replace .to_bytes() with the special .__bytes__ function 2017-10-17 19:54:59 +02:00
Lonami Exo
63dfb1e3ea Fix processing messages pending of acknowledge many times 2017-10-17 10:15:13 +02:00
Andrey Egorov
ed77ba6f8f Likely fix .log_out crashing "calling Event" (#349) 2017-10-17 00:39:04 +02:00
Lonami Exo
917665852d Merge branch 'master' into asyncio 2017-10-16 10:03:01 +02:00
Lonami Exo
27728be242 Revert "Attempt at not calling .connect for every file chunk"
This reverts commit 280a700655.
The reason for this is that it was causing a lot of files to
be downloaded corrupted for some reason. This should be
revisited to avoid creating a new connection for every chunk.
2017-10-15 11:05:56 +02:00
Lonami Exo
d92e8e11ad Update to v0.15.2 2017-10-14 12:05:28 +02:00