Lonami Exo
ad1ab64415
Save last ack to resend in case of bad salt
2018-06-20 11:12:04 +02:00
Lonami Exo
463847ad50
Revisit and remove a few TODOs
2018-06-18 18:46:06 +02:00
Lonami Exo
ebfe8ebf40
Configurable per-client request/connection retries
2018-06-18 18:13:00 +02:00
Lonami Exo
09ea1179ca
Except msg_id KeyError on bad salt/msg
2018-06-18 17:20:31 +02:00
Lonami Exo
3648f7c756
Log outgoing message types and incoming message IDs
2018-06-18 17:14:04 +02:00
Lonami Exo
51d8ea0fa8
Shield disconnected Future in the MTProtoSender instead
2018-06-18 15:55:24 +02:00
Lonami Exo
7641ba2d32
Fix sleep on the wrong indent and handle CancelledError
...
This was causing a huge slow-down every time a request was
received delaying all the subsequent incoming messages too
2018-06-18 13:29:12 +02:00
Lonami Exo
374f5e2aab
Periodically send ping/getState
2018-06-18 13:22:25 +02:00
Lonami Exo
94d6c339c4
Add more logging in the MTProtoSender
2018-06-18 11:29:54 +02:00
Lonami Exo
e36aff51dd
Raise ConnectionError when sending without connection
...
Otherwise the program could potentially block on await client(...)
since this has no timeout (unless asyncio.wait_for() was used) and
would give no further hint that the program was halted there.
2018-06-17 20:25:22 +02:00
Dan Elkouby
d5b349e031
Implement a mechanism to notify of connection failures ( #852 )
2018-06-17 19:29:41 +02:00
Lonami Exo
d9d586171f
Fix MTProtoSender should not send content-related queries
2018-06-17 16:23:22 +02:00
Lonami Exo
d18ee9ecc5
Handle (re)connection errors more gracefully
2018-06-17 11:41:35 +02:00
Lonami Exo
8086772506
Make sure not to include sentinel in containers
2018-06-16 18:40:08 +02:00
Lonami Exo
bb2cacd525
Fix automatic reconnection by unblocking the send queue
2018-06-16 18:34:36 +02:00
Dan Elkouby
df15ee421c
Except connection timeouts in MTProtoSender
2018-06-15 10:58:29 +03:00
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