Commit graph

164 commits

Author SHA1 Message Date
Dan
cf1e31c413 Apply security checks to each message in the container 2022-12-29 23:33:58 +01:00
Dan
d890e5346c Clear stored_msg_ids on session stop 2022-12-28 17:44:02 +01:00
Dan
1daa05a35c Raise and handle send errors in order to immediately act upon 2022-12-28 00:21:05 +01:00
Dan
5ca422b314 Create a future result before sending its request 2022-12-28 00:19:28 +01:00
Dan
9bf742abc0 Introduce back some previously reverted changes 2022-12-27 13:40:42 +01:00
Dan
bff583ed75 Revert some of the latest changes 2022-12-26 22:26:55 +01:00
Dan
235dde2251 Update exception message 2022-12-26 20:11:58 +01:00
Dan
01cd8bb57f Optimize log calls 2022-12-26 16:38:12 +01:00
Dan
d298c62c6d Update session.py 2022-12-26 16:34:49 +01:00
Dan
ce8c242eb4 Revert to triggering a reconnection when skipping invalid packets 2022-12-25 15:14:12 +01:00
Dan
b23e34494e Add messages for mismatched checks 2022-12-25 15:08:02 +01:00
Dan
ae028ab4b6 Switch back to local system time synchronization
perf_counter will stop counting when the system goes to sleep, causing
the generation of invalid message ids after waking up which in turn put
the client into a never ending reconnecting loop due to check mismatches
caused by the time not being synced anymore. It's also unclear whether
perf_counter stays in sync during long runs.
2022-12-25 14:55:40 +01:00
Dan
4c32a15cfd Remove unneeded threading.Lock 2022-12-25 10:30:56 +01:00
Dan
84d60b56b3 Switch to non-blocking sockets & use a send queue 2022-12-24 16:15:07 +01:00
Dan
b59dcd1615 Do not trigger a reconnection when skipping invalid packets 2022-06-20 09:32:10 +02:00
Dan
7c3c0565b4 Fix wrapped function invocations 2022-05-14 17:29:11 +02:00
Dan
4e1b54288b Fix Client.name usage 2022-04-24 11:56:07 +02:00
Dan
124bcb4db7 Remove API key requirement for existing sessions 2022-04-24 11:56:07 +02:00
Dan
0e3c2e4412 Rename RPCError.x to RPCError.value 2022-04-24 11:56:07 +02:00
Dan
78efb04b40 Rename Client.send to Client.invoke 2022-04-24 11:56:07 +02:00
Dan
dc6c816c80 Revert some of the last changes 2022-02-10 06:44:42 +01:00
Dan
5889c67fb5 Initialize session on reconnection 2022-02-10 05:34:21 +01:00
Stark Programmer
5d155b896c
Add missing await keyword (#898) 2022-02-10 02:22:43 +01:00
Dan
462e5d11a5 Improve stability in case of connection failures 2022-02-10 01:05:36 +01:00
Dan
3a911956b0 Update message for automatic sleeps 2022-01-31 20:45:04 +01:00
Dan
6f9e77bc2c Do not handle messages with a pending ack 2022-01-31 20:42:44 +01:00
Dan
1162e89f26 Better handling of expiring server salts 2022-01-20 09:43:29 +01:00
Dan
626a1bd938 Update copyright year 2022-01-07 10:23:45 +01:00
Dan
8c8288412f Various improvements 2022-01-07 10:18:51 +01:00
Dan
a3fab6af4b Merge branch 'mtproto-checks'
# Conflicts:
#	pyrogram/errors/__init__.py
#	pyrogram/session/session.py
2021-12-24 16:28:29 +01:00
Dan
56e7e11037 Use a specialized exception for handling BadMsgNotification 2021-12-22 14:01:05 +01:00
Dan
8aa358129c Use specialized exceptions for handling security checks 2021-12-16 21:38:24 +01:00
Dan
ed9c7e4694 Simplify the error handling a bit 2021-12-15 19:26:54 +01:00
Dan
2a1af2b8e9 Close and reestablish the TCP connection in case of mismatch 2021-12-15 16:02:39 +01:00
Dan
cd027b8c1c Implement missing MTProto checks 2021-12-15 13:18:13 +01:00
Dan
54350dc943 Merge branch 'handle-503-timeout' 2021-04-26 15:32:07 +02:00
Dan
3c81006b40 Merge branch 'media-servers' 2021-04-26 15:31:08 +02:00
Dan
c5624c639b Cleaner error message 2021-04-15 12:17:25 +02:00
Dan
0c814e9e5e Add support for media DC IPs 2021-04-13 15:53:53 +02:00
Dan
70ae12eb77 Handle ServiceUnavailable errors
#664
2021-04-12 09:21:20 +02:00
Dan
a48d27f501 Always run crypto-related functions in the dedicated thread 2021-01-02 18:45:43 +01:00
Dan
7dda167c09 Update copyright notice
Year 2021
2021-01-01 22:58:48 +01:00
Dan
a8a9a1ac1f Also print the exception type when logging query issues
Use "repr(e)" instead of "e" alone (i.e "str(e)") because sometimes
builtin exceptions have no message (for example: OSError, TimeoutError)
2020-12-27 21:08:01 +01:00
Dan
8b3e1ce9cc Make generating new salts independent of the system clock
Closes #553
2020-12-12 16:46:40 +01:00
Dan
844e53a70e Move crypto calls to threads in case of big enough chunks 2020-12-07 19:16:46 +01:00
Dan
76985faa11 Evaluate debug raw data only when actually needed
#541
2020-11-20 01:53:19 +01:00
Dan
15bdb3de4f Attempt to fix clock issues when running on AWS Lambda 2020-08-29 17:28:39 +02:00
Dan
5e3f2ab947 Replace monotonic() with perf_counter()
It seems like monotonic() goes out of sync after some time.
2020-08-29 16:58:49 +02:00
Dan
582e29dece Allow passing sleep_threshold=0 to always raise flood waits 2020-08-27 10:59:28 +02:00
Dan
7c987889f0 Add sleep_threshold parameter to send() method
- Decrease the default sleep threshold from 60 to 10 seconds
- Use a higher sleep threshold for generator methods
2020-08-26 09:01:01 +02:00