Commit Graph

163 Commits

Author SHA1 Message Date
Dan
cc7901adf8 Merge branch 'develop' into asyncio 2018-09-06 20:05:01 +02:00
Dan
b619818c40
Clear recv_queue on session stop. Fixes #103 2018-09-03 16:35:22 +02:00
Dan
4c9d9d84f2 Change the way int to bytes conversion is used
Maybe at some point I should switch to struct
2018-09-01 01:27:22 +02:00
Dan
10f3829c93 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/connection/connection.py
#	pyrogram/connection/transport/tcp/tcp.py
#	pyrogram/connection/transport/tcp/tcp_intermediate.py
#	pyrogram/session/session.py
2018-09-01 01:05:25 +02:00
Dan
49f2cbe04f Move CURRENT_DH_PRIME into Prime namespace 2018-08-29 22:04:04 +02:00
Dan
b845544e63 Info log device and system parameters 2018-08-28 12:39:14 +02:00
Dan
f50638772c Minor fix: update info log 2018-08-28 12:38:02 +02:00
Dan
a0c1018a1b Minor style fix 2018-08-28 12:25:08 +02:00
Dan
973ccfcd03 Use compact IPv6 addresses 2018-08-28 12:23:22 +02:00
Dan
4b3b647245 Merge branch 'ipv6' into develop
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/session/session.py
2018-08-28 12:19:37 +02:00
Dan
2f1d447783 Move INITIAL_SALT to Session 2018-06-28 17:50:37 +02:00
Dan
4f4531cf18 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/session/session.py
2018-06-28 00:41:11 +02:00
Dan
6e4c608875 Handle AUTH_KEY_DUPLICATED error 2018-06-28 00:16:12 +02:00
Dan
77c696aec0 Merge branch 'develop' into asyncio 2018-06-27 17:21:14 +02:00
Dan
ecaba45523 Keep only lang_code 2018-06-27 00:42:32 +02:00
Dan
c8468ccdd1 Merge branch 'develop' into asyncio 2018-06-24 19:29:31 +02:00
Dan
c7d60ef8a6 Fix disconnect handler callback being called on every session 2018-06-24 19:29:12 +02:00
Dan
5f727cb5a2 Merge branch 'develop' into asyncio
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
#	pyrogram/client/methods/bots/request_callback_answer.py
#	pyrogram/session/session.py
2018-06-24 19:27:37 +02:00
Dan
55ef4abb27 Allow user-defined session properties. Related to #86
This commit adds five 5 extra parameters to the Client class:
app_version, device_model, system_version, system_lang_code, lang_code
2018-06-24 18:47:49 +02:00
Dan
f4c0793a0b Make session leaner by removing some redundant parameters
Related to #86
2018-06-24 18:27:41 +02:00
Dan
69d1432251 Allow user-defined values for retries and timeout 2018-06-24 17:47:29 +02:00
Dan
81c8fca11c Make the on_disconnect callback function a coroutine 2018-06-24 11:40:43 +02:00
Dan
8049c9129b Make Auth asynchronous 2018-06-18 13:07:02 +02:00
Dan
1bc599e26c Delegate timeout to TCP 2018-06-17 19:20:22 +02:00
Dan
57f917e6df Don't print out the current salt 2018-06-17 18:39:08 +02:00
Dan
f983baf5cd Add some more logs 2018-06-17 18:34:37 +02:00
Dan
6da15b266d Await tasks before stopping the session 2018-06-17 18:34:10 +02:00
Dan
2b0746a140 Add timeout on recv loop 2018-06-17 18:33:23 +02:00
Dan
39b66b51d6 Remove salt assertion 2018-06-16 22:05:54 +02:00
Dan
d1d789bf20 Fix restart not awaiting 2018-06-15 14:30:13 +02:00
Dan
d06e486c8b Reorganize imports 2018-06-14 13:30:46 +02:00
Dan
eeaf01654b Code style 2018-06-14 13:05:22 +02:00
Dan
b1f6131971 Remove unused constant 2018-06-14 13:04:52 +02:00
Dan
775cbb568f Small fixes 2018-06-14 03:27:30 +02:00
Dan
68133e8be5 Better logs 2018-06-14 03:26:57 +02:00
Dan
463ef828c2 Use put_nowait instead of put 2018-06-14 03:25:15 +02:00
Dan
2cf930bea0 Remove commented MTProto methods 2018-06-14 03:24:39 +02:00
Dan
11ddf5f99d Reorganize Session to make use of the MTProto module 2018-06-14 03:22:52 +02:00
Dan
0b03612bc7 Make restart async 2018-06-13 21:01:28 +02:00
Dan
a9ccbaca19 Fix ping request not awaiting 2018-06-13 20:03:54 +02:00
Dan
b804709c6c Allow session to use ipv6 2018-06-13 13:37:35 +02:00
Dan
c9469ed542 Allow auth to use ipv6 2018-06-13 13:37:12 +02:00
Dan
8ac48c555c Add ipv6 data center addresses 2018-06-13 13:34:56 +02:00
Dan
e2546e77ae Start rewriting Session using asyncio 2018-06-12 15:56:33 +02:00
Dan
d67dfd39da Update system messages TL scheme 2018-06-03 18:07:04 +02:00
Dan
65c209000c Connection refactoring 2018-05-24 21:19:57 +02:00
Dan
9001ccd11f Add DisconnectHandler 2018-05-23 14:27:17 +02:00
Dan
f0c801be8c Rename AES class methods and add ctr256_encrypt 2018-05-18 14:15:35 +02:00
Dan
e270c7d5f8 Remove unpack_dispatch_and_ack method 2018-05-06 14:55:41 +02:00
Dan
de332471df Join net worker threads before stopping. Fixes #62 2018-04-29 20:30:32 +02:00
Dan
b59212dbf2 Fix send() not returning the value in case of a retry 2018-04-18 17:19:42 +02:00
Dan
639828f550 Retry on internal server errors, up to MAX_RETRIES times
Also add support for custom retry count
2018-04-18 15:17:46 +02:00
Dan
4965e0b4f8 Remove warning 2018-04-14 17:37:37 +02:00
Dan
6dcdeda244 Make proxy loading simpler 2018-04-13 12:30:13 +02:00
Dan
9dc767b88e Wait a little bit before retrying 2018-04-12 10:41:52 +02:00
Dan
552474a0e2 Raise any other unknown exception 2018-04-12 08:30:52 +02:00
Dan
862567a1ed Tune session settings 2018-04-12 08:29:39 +02:00
Dan
1736a8ea9b Use port 443 for production servers 2018-04-11 23:37:59 +02:00
Dan
cce937e54b Set correct type hint 2018-04-05 11:43:56 +02:00
Dan
6fd8b582b2 More useful logging 2018-03-16 11:30:05 +01:00
Dan
4dbf1ef5ac Improve re-connection speed 2018-03-16 11:18:16 +01:00
Dan
756311710c Don't GetTermsOfService() anymore 2018-03-15 12:03:02 +01:00
Dan
475012144d
Increase WAIT_TIMEOUT to 30s 2018-03-13 00:21:48 +01:00
Dan
cc49815cc5 req_pq is deprecated, use req_pq_multi instead 2018-03-08 10:14:26 +01:00
Dan
26adfc2ef4 Add BadMsgNotification error descriptions. Fixes #26 2018-02-22 01:31:39 +01:00
Dan
140a8b4e12 Catch RPCError in InitConnection 2018-02-21 13:35:17 +01:00
Dan
02da3fe947 Handle TCP server errors 2018-02-18 20:33:33 +01:00
Dan
d89d238d30 Fix BadMsgNotification error_code 32 2018-02-18 17:31:00 +01:00
Dan
1bf74a9c25 Merge branch 'master' into tgcrypto 2018-02-16 18:42:43 +01:00
Dan
ad6cfcd165 Use PingDelayDisconnect instead 2018-02-15 21:06:25 +01:00
Dan
e14a3644ba Merge branch 'master' into tgcrypto 2018-02-14 17:34:21 +01:00
Dan
aca6fa390e Add SeqNo lock 2018-02-13 14:00:03 +01:00
Dan
560991498d Add MsgId lock 2018-02-13 13:59:29 +01:00
Dan
df89669e04 Revert back to "set_update_handler" name 2018-02-13 12:08:10 +01:00
Dan
85b573d1e5 Set NET_WORKERS to 1 2018-02-10 18:28:11 +01:00
Dan
f158b780aa Merge branch 'master' into tgcrypto 2018-02-09 03:27:13 +01:00
Dan
bd75dc8082 Set NET_WORKERS to 2 2018-02-08 20:47:56 +01:00
Dan
d8edfb38bf Move update handler into Client 2018-02-08 20:46:47 +01:00
Dan
7cee6b079f Revert to fixed NET_WORKERS count 2018-02-08 19:48:01 +01:00
Dan
5885f38245 Remove TODO 2018-02-08 19:03:44 +01:00
Dan
f36bb2678c Remove unused 2018-02-08 19:03:04 +01:00
Dan
f8688cd260 Rename worker to net_worker 2018-02-08 18:56:40 +01:00
Dan
00631fcc33 Use a better variable name 2018-02-08 17:34:00 +01:00
Dan
3097cadd8a Clean 2018-02-08 17:23:37 +01:00
Dan
807a50b82c Pass the client to the update handler as parameter 2018-02-01 02:41:19 +01:00
Dan
2b7425019b Merge IGE and CTR into a single class (AES) 2018-01-28 01:44:38 +01:00
Dan
7234edad5d Add ability to choose the amount of worker threads for the main session 2018-01-26 11:41:09 +01:00
Dan
ba21430512 Add SOCKS5 proxy support 2018-01-16 22:05:19 +01:00
Dan
5244e962d1 Fix reformatted functions names 2018-01-04 16:30:29 +01:00
Dan
d70c2bb564 Update copyright year 2018-01-01 13:24:07 +01:00
Dan
8339f493bc Don't retry forever 2017-12-31 11:46:42 +01:00
Dan
df5cee5b03 Remove unnecessary branch 2017-12-28 13:10:01 +01:00
Dan
211381a9a8 Skip already processed messages 2017-12-28 13:06:26 +01:00
Dan
f62ce30dbf Check if not None before calling .join() 2017-12-26 01:19:38 +01:00
Dan
5128f6310b Wait for threads to stop when closing the session 2017-12-23 23:43:20 +01:00
Dan
0231ce58d5 Remove some TODOs in code 2017-12-23 14:02:14 +01:00
Dan
ef7ee13a56 Wait a second before retrying 2017-12-22 09:27:47 +01:00
Dan
e8f04793ea Add CDN DC-121 IP in production DCs list 2017-12-22 09:27:13 +01:00
Dan
14632c9bb1 Don't call InitConnection on CDN DCs 2017-12-19 11:38:15 +01:00
Dan
cbaa50747a Add CDN DC-121 IP 2017-12-19 11:35:26 +01:00