Commit Graph

2615 Commits

Author SHA1 Message Date
Lonami Exo
dfab8f5e20 Avoid caching event loop in telethon.sync
This would cause issues when creating and setting a different
event loop from a different thread since it would use the old
loop and not the new one, solved by explicitly getting the
loop every time, although this has a slight performance hit.
2018-11-10 11:34:26 +01:00
Lonami Exo
f046d1f0a3 Fix deadlock on unexpected disconnections 2018-11-10 11:23:19 +01:00
Lonami Exo
f6bc80bc6b Fix cancellation of custom conversation events from d474458 2018-11-08 10:08:41 +01:00
Lonami Exo
cdbd1f6193 Fix valid auth_key never being saved after switching DC 2018-11-03 18:53:26 +01:00
Lonami Exo
0fc97a3e8c Update to v1.4 2018-11-03 12:46:19 +01:00
Lonami Exo
8e6b98669a Get rid of full_sync 2018-11-03 12:46:19 +01:00
Lonami Exo
c70943bb0e Add CHAT_RESTRICTED to known errors 2018-11-03 12:46:19 +01:00
K900
20a8081e8e Fix file cache when using MemorySession (#1033) 2018-11-01 10:29:23 +01:00
Lonami Exo
67c5572d7b Possibly fix possible deadlock 2018-10-28 11:53:28 +01:00
painor
45999001be Added retry_delay parameter for auto-reconnection (#1031) 2018-10-28 10:55:58 +01:00
Lonami Exo
15546fd957 Update client package documentation missing some subclasses 2018-10-28 10:21:03 +01:00
Lonami Exo
24970a875a Fix raising PasswordHashInvalid missing request arg too 2018-10-27 09:40:30 +02:00
Lonami Exo
2863eb8cc9 Fix raising local FloodWait missing request argument 2018-10-27 09:39:00 +02:00
Lonami Exo
5beaf46e09 Add extra checks to the #haste command 2018-10-26 10:49:02 +02:00
Lonami Exo
b0e587c03d Except expected ConnectionError in the receive loop 2018-10-26 10:36:33 +02:00
Lonami Exo
0d8b15a109 Add #haste command to assistant and fix typo 2018-10-26 10:25:29 +02:00
Lonami Exo
091180b32d Except CancelledError in MTProtoSender send/recv loop
This way, the tasks should not end with the cancelled exception
which should get rid of the warning if any.
2018-10-25 15:54:25 +02:00
Kyle2142
eacfa226fd Add Conversation.cancel() (#1030) 2018-10-25 15:37:36 +02:00
Lonami Exo
2c61c50671 Save session on connect and fix some typos
The session is saved upon connecting with the hope to make
sure that the authorization key gets saved to disk before
the next run.
2018-10-24 16:39:59 +02:00
Lonami Exo
4562ba9ccf Fix auth_key not actually being saved
This would make the user have to login every time.
2018-10-22 20:58:07 +02:00
Lonami Exo
7dece209a0 Cancel tasks on reconnect instead of awaiting them
This prevents us from locking forever on any task that doesn't
rely on cancellation tokens, in this case, Connection.recv()'s
_recv_queue.get() would never complete after the server closed
the connection.

Additionally, working with cancellation tokens in asyncio is
somewhat annoying to do.

Last but not least removing the Connection._disconnected future
avoids the need to use its state (if an exception was set it
should be retrieved) to prevent asyncio from complaining, which
it was before.
2018-10-21 16:20:05 +02:00
Lonami Exo
f2e77f4030 Fix using the wrong logger in Connection 2018-10-21 16:10:09 +02:00
Lonami Exo
740a715acd Handle empty code when starting 2018-10-21 16:05:31 +02:00
Lonami Exo
0755421fc2 Fix update loop should not disconnect causing race condition
When starting the client, on phone migrations, it would
disconnect twice right after connecting which would
trigger a not-connected error.
2018-10-21 16:02:13 +02:00
Ivan Tung
c248a102dc Fix-up 99129da error generation if error.has_captures (#1025) 2018-10-21 15:22:46 +02:00
Lonami Exo
396ec908dd Fix _borrow_exported_sender connection 2018-10-20 17:11:40 +02:00
Lonami Exo
f51b56558d Document AUTH_KEY_DUPLICATED, better assistant UX 2018-10-19 19:32:17 +02:00
Lonami Exo
39929db2b8 Patch __enter__/__exit__ specially in full_sync 2018-10-19 18:04:53 +02:00
Lonami Exo
a2bae8374e Fix .get_entity('me') not working from c31635c (#1024) 2018-10-19 16:57:46 +02:00
Lonami Exo
0686ec4440 Implement after_msg_id back 2018-10-19 16:53:50 +02:00
Lonami Exo
9dc4009152 Handle the right errors 2018-10-19 14:41:50 +02:00
Lonami Exo
b93b01cb02 Fix manual BadMessageError instantiation 2018-10-19 14:02:20 +02:00
Lonami Exo
6b280dc3bd Clarify MTProtoSender._disconnected 2018-10-19 14:01:03 +02:00
Lonami Exo
945b34b103 Set MTProtoSender.auth_key on its creation 2018-10-19 13:56:11 +02:00
Lonami Exo
8563b9560d Fix auth_key not being set 2018-10-19 13:35:29 +02:00
Lonami Exo
939854a0dd Fix-up e2fe3eb (packer was OK, encryption was not made) 2018-10-19 13:33:24 +02:00
Lonami Exo
f5bc952309 Don't set the disconnected flag twice 2018-10-19 13:25:00 +02:00
Lonami Exo
e2fe3eb503 Use new broken MessagePacker 2018-10-19 13:24:52 +02:00
Lonami Exo
83f60deef9 Allow updating AuthKey.key
This will preserve references to the AuthKey more cleanly.
2018-10-19 12:40:36 +02:00
Lonami Exo
6d30a38316 Let Connection._disconnected be a proper Future
This means that awaiting on disconnect will properly raise errors,
allowing to differentiate clean disconnects from faulty ones.
2018-10-19 10:46:34 +02:00
Lonami Exo
542d0f539b Revisit connection and properly detail the class' intent 2018-10-19 10:35:22 +02:00
Lonami Exo
e5fc9d8674 Fix several broken links in the docs 2018-10-17 11:50:11 +02:00
Lonami Exo
a9a2401e44 Fix CallbackQuery using string regex 2018-10-17 11:44:08 +02:00
Lonami Exo
419fe6dca3 Raise RuntimeError on with blocks that need async 2018-10-17 11:30:07 +02:00
Lonami Exo
9cbc088b76 Make disconnect synchronous
This also fixes a bug when auto-reconnecting in MTProtoSender.
2018-10-16 11:56:17 +02:00
Lonami Exo
477fbd8dc7 Generate simple examples for the docs 2018-10-16 09:29:48 +02:00
Lonami Exo
8f04ec820f Don't add functions as possible argument types 2018-10-15 21:12:10 +02:00
Lonami Exo
bb180a1db8 Split generator/tlobject into separate files 2018-10-15 19:29:32 +02:00
Lonami Exo
e3c4bd46fb Reference argument types to objects when parsing .tl 2018-10-15 19:23:09 +02:00
Lonami Exo
b219da6b87 Fix Dialog.is_group for types.ChatForbidden 2018-10-15 18:43:53 +02:00