Commit Graph

187 Commits

Author SHA1 Message Date
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
Lonami Exo
ae87d452c8 Clean-up docs and merge some imports 2018-05-30 18:55:01 +02:00
Lonami Exo
ee51aa7073 Fix lost requests on disconnect need_confirmation.clear
The pending acks shouldn't be cleared, in case of a reconnection
these would be pretty common. E.g. disconnect(), connect(),
invoke, repeat.
2018-05-10 16:45:55 +02:00
Lonami Exo
eb22bce2d9 Add missing connect abstractmethod 2018-05-10 16:16:23 +02:00
Lonami Exo
ba4b7ce881 Make the Connection a proper ABC (#509) 2018-05-10 14:22:19 +02:00
Lonami Exo
dd954b8fbd Avoid receive busy wait when two threads receive items 2018-05-10 09:44:25 +02:00
Lonami Exo
ef509d13c7 Move InvokeAfterMsg to TLMessage to cleanly confirm results 2018-05-09 16:18:42 +02:00
Lonami Exo
e2e7e631b5 Stop using *args when invoking many requests at once 2018-05-09 10:19:45 +02:00
Lonami Exo
e200acbca8 Allow sending ordered MessageContainer 2018-05-09 09:46:07 +02:00
Lonami Exo
6652fe276c Remove broken packet length check 2018-05-07 17:05:27 +02:00
Lonami Exo
f06b9b68d5 Fix race condition causing broken responses 2018-05-07 17:01:04 +02:00
Lonami Exo
2922e8df11 Fix still broken log for broken packets 2018-05-07 16:46:58 +02:00
Lonami Exo
ace715e059 Don't log broken packets as individual bytes 2018-04-14 15:02:27 +02:00
Lonami Exo
2b9babb30f Handle GzipPacked lost requests & possibly fix reading normal
Reading normal "lost" requests didn't .seek(-4) to read the TLObject
again. Now it has been slightly refactored to seek back always and
only seek forward when needed (e.g. rpc error).
2018-03-30 11:50:41 +02:00
Lonami Exo
43c6896481 Add a custom role for TL references and make use of it 2018-03-23 21:42:17 +01:00
Lonami Exo
fca4904d0f Add more logging calls when confirming a request 2018-03-07 11:30:03 +01:00
Tulir Asokan
c5e6f7e265 Split Session into three parts and make a module for sessions 2018-03-01 23:40:28 +02:00
Lonami Exo
39621ceae9 Use req_pq_multi instead req_pq when creating an auth_key 2018-02-19 20:31:47 +01:00
Lonami Exo
c83638ed0e Add further logging calls to better spot lost requests 2018-02-12 13:40:00 +01:00
Lonami Exo
bf56d32118 Add missing FutureSalts response special case (#81) 2018-01-30 18:32:42 +01:00
Lonami Exo
c5e969d585 Add more useful logging on invalid packet length received 2018-01-13 19:26:45 +01:00
Lonami Exo
d81dd055e6 Remove temporary connections and use a lock again
These seem to be the reason for missing some updates (#237)
2018-01-06 23:45:22 +01:00
Lonami Exo
3eafe18d0b Implement MtProto 2.0 (closes #484, thanks @delivrance!)
Huge shoutout to @delivrance's pyrogram, specially this commit:
pyrogram/pyrogram/commit/42f9a2d6994baaf9ecad590d1ff4d175a8c56454
2018-01-06 01:55:11 +01:00
Lonami Exo
c848ae0ace Move tgread_object() outside specific msg processing calls 2017-12-20 17:45:40 +01:00
Lonami Exo
5842d3741b Make a proper use of the logging module 2017-12-20 12:47:39 +01:00
Lonami Exo
0e0bc6ecbc Fix session ID is also signed since d4d7aa9 2017-12-07 12:22:40 +01:00
Lonami Exo
1d19bb22a5 Don't ignore NewSessionCreated salt 2017-12-04 20:34:35 +01:00
Lonami Exo
d4d7aa9063 Use signed salt 2017-12-03 21:10:22 +01:00
Lonami Exo
9046b46fcd Document the network/ module 2017-11-30 13:21:01 +01:00
Lonami Exo
74ec6391d9 Fix-up security assertion (b42b4bb for #453) 2017-11-24 19:05:52 +01:00
Maxim Smirnov
b42b4bb326 Add OpenSSL assertion on authenticator.py (#453)
aes_ige.c(88): OpenSSL internal error, assertion failed
2017-11-24 18:47:36 +01: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
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