Commit Graph

31 Commits

Author SHA1 Message Date
Lonami Exo
091b03c635 Use create_task instead ensure_future 2018-06-14 23:33:56 +02:00
Lonami Exo
0f14f3b16a Support custom event loops 2018-06-14 19:35:12 +02:00
Lonami Exo
5bb2f50232 Handle Msg state/resend/all (from 7c0af2c by @andr-04) 2018-06-14 16:23:16 +02:00
Lonami Exo
4a9eb5b085 Handle OSError on MTProtoSender 2018-06-14 16:16:11 +02:00
Lonami Exo
8a787e90c2 Remove send/recv locks
There is only one method sending and one method receiving,
so it doesn't make sense to lock-protect those operations.
2018-06-13 10:04:27 +02:00
Lonami Exo
d1afc70963 Fix setting Pong results 2018-06-12 19:46:37 +02:00
Lonami Exo
64dd957189 Fix None first_query and TcpClient.disconnect() 2018-06-11 19:51:01 +02:00
Lonami Exo
15ef302428 Implement _switch_dc/fix missing first request 2018-06-10 21:30:31 +02:00
Lonami Exo
4a491e45ce Fix broken debug call 2018-06-10 21:02:22 +02:00
Lonami Exo
3e151a1b7a Make TelegramBareClient able to invoke requests 2018-06-09 21:03:48 +02:00
Lonami Exo
7e68274f26 Keep consistent structure and remove done TODO 2018-06-09 15:42:10 +02:00
Lonami Exo
acd6025731 Use put_nowait and avoid double await 2018-06-09 15:26:13 +02:00
Lonami Exo
be279ce3f5 Make TLMessage always have a valid TLObject
This simplifies the flow instead of having separate request/body
attributes, and also means that BinaryReader.tgread_object() can
be used without so many special cases.
2018-06-09 13:48:27 +02:00
Lonami Exo
f7e8907c6f Create RpcResult class and generalise core special cases
This results in a cleaner MTProtoSender, which now can always
read a TLObject with a guaranteed item, if the message is OK.
2018-06-09 13:13:55 +02:00
Lonami Exo
adfe861e9f Create a self-contained MTProtoState
This frees us from using entire Session objects in something
that's supposed to just send and receive items from the net.
2018-06-09 11:34:01 +02:00
Lonami Exo
a63580c350 Private methods are not public API 2018-06-08 21:18:15 +02:00
Lonami Exo
6766c4eea9 Make heavy use of logging 2018-06-08 21:13:14 +02:00
Lonami Exo
e36517845a Retry on connection/security errors 2018-06-08 20:50:53 +02:00
Lonami Exo
92b606a3e8 Automatically reconnect on connection reset 2018-06-08 20:42:39 +02:00
Lonami Exo
5c917fb425 Except timeout error and retry 2018-06-07 18:01:18 +02:00
Lonami Exo
f72ddbdd5a Implement retry and fail cases in authenticator 2018-06-07 17:25:02 +02:00
Lonami Exo
df895a94ab Create auth_key if not present 2018-06-07 16:32:12 +02:00
Lonami Exo
a940e2e9a2 Process entities and add a handler for updates 2018-06-07 14:32:22 +02:00
Lonami Exo
c7e4ae8672 Send acks 2018-06-07 14:16:47 +02:00
Lonami Exo
805bf00dee Support sending multiple requests at once 2018-06-07 14:04:04 +02:00
Lonami Exo
884dbe2d1f Use a custom Queue to simplify the _send_loop 2018-06-07 13:51:19 +02:00
Lonami Exo
382355a22f Collapse multiple requests into a single container 2018-06-07 13:33:32 +02:00
Lonami Exo
a3687b8bb5 Complete all methods under MTProtoSender and document them 2018-06-07 12:29:43 +02:00
Lonami Exo
56b09c0c9d Properly set future results 2018-06-07 10:30:20 +02:00
Lonami Exo
9477c75fce Fix basic requests sending and receiving 2018-06-06 21:42:48 +02:00
Lonami Exo
e469258ab9 Create a new MTProtoSender structure and its foundation
This means that the TcpClient and the Connection (currently only
ConnectionTcpFull) will no longer be concerned about handling
errors, but the MTProtoSender will.

The foundation of the library will now be based on asyncio.
2018-06-06 20:41:01 +02:00