Commit Graph

80 Commits

Author SHA1 Message Date
Lonami Exo
f233110732 Allow sending several requests at once through new MessageContainer 2017-09-25 20:52:27 +02:00
Lonami Exo
0f10e1419f Update to v0.13.6 2017-09-23 11:44:04 +02:00
Lonami Exo
f39f9c33a0 Fix timeout on confirm_received.wait not being added (fix #257) 2017-09-22 19:20:37 +02:00
Lonami Exo
9ce4307304 Update to v0.13.5 2017-09-22 16:12:43 +02:00
Lonami Exo
b0f6b23e52 Fix creating new connections accessing invalid attributes 2017-09-22 16:11:07 +02:00
Lonami Exo
d8bf8bb2eb Fix reconnect always returning False -> infinite loop 2017-09-22 12:48:04 +02:00
Lonami Exo
4d5f16f2aa Fix background thread could not reconnect properly 2017-09-22 12:44:09 +02:00
Lonami Exo
4245ec5abc Make reconnect private 2017-09-22 12:31:41 +02:00
Lonami Exo
bc15b451b5 Use a safer reconnect behaviour (respect multithread too) 2017-09-22 12:20:38 +02:00
Lonami Exo
4ba12e717f Fix reconnect to new_dc wasn't changing connection.ip 2017-09-21 13:58:57 +02:00
Lonami Exo
2b2da843a1 Create a Connection only once and avoid no-op if was "connected" 2017-09-21 13:44:22 +02:00
Lonami Exo
e12e82357d Update to v0.13.4 2017-09-18 13:32:16 +02:00
Lonami Exo
e7a936222f Catch -404 BrokenAuthKeyError on .connect()'s .do_authentication 2017-09-17 18:38:03 +02:00
Lonami Exo
58fe39f060 Expose MtProtoSender.is_connected() and use it on .connect() 2017-09-17 16:39:29 +02:00
Lonami Exo
76b7420b63 Ignore TimeoutError when invoking a request 2017-09-17 16:32:51 +02:00
Lonami Exo
2f0f6d4591 Remove initial_query leftovers 2017-09-17 16:20:04 +02:00
Lonami Exo
aea10b103b Rename generated layer variable to uppercase readonly property 2017-09-17 16:17:55 +02:00
Lonami Exo
c84e54b647 Get rid of the initial_query= parameter on .connect() 2017-09-17 16:06:43 +02:00
Lonami Exo
2689b0750d Make DC options static
Some datacenters don't allow calling GetConfigRequest,
this way it can both be reused and such calls omitted.
2017-09-17 15:19:21 +02:00
Lonami Exo
59a4315c28 Avoid calling InitConnectionRequest when it's not needed 2017-09-17 14:26:25 +02:00
Lonami Exo
29471f3bba Force obfuscated2 mode if api_id < 20 2017-09-15 11:49:39 +02:00
Lonami Exo
279eb110be Update to v0.13.3 2017-09-14 11:51:41 +02:00
Lonami Exo
1d36bbfbf4 Remove forgotten invalid code CdnDecrypter.finish_check (fix #243) 2017-09-12 15:38:00 +02:00
Lonami Exo
48dead76ac Retry up to five times before giving up on a request 2017-09-11 10:52:36 +02:00
Lonami Exo
fa4042a80e Update to v0.13.2 2017-09-08 13:22:05 +02:00
Lonami Exo
c81537bed0 Simplify the workflow with UpdateState exposing a single flag param 2017-09-08 12:54:38 +02:00
Lonami Exo
a24b4020fe Allow adding update handlers without the need to poll updates 2017-09-07 20:29:51 +02:00
Lonami Exo
d4f36162cd Create and use UpdateState to .process() unhandled TLObjects 2017-09-07 18:49:08 +02:00
Lonami Exo
49555ad018 Stick to the offset and limit CdnFileHashes dictates (#222)
The old intersection method and allowing an arbitrary part size
wasn't working properly. Assuming that Telegram will send a sha
sum for the whole file, in the correct order, we can simply use
their offsets to download the file.
2017-09-05 16:43:53 +02:00
Lonami Exo
2924912931 Fix CDN downloads not always calling GetCdnConfigRequest (#222)
On previous tests, Telegram didn't return information about CDNs
on the initial GetConfigRequest. However, it may do so, and it's
necessary to call GetCdnConfigRequest even when a second call to
GetConfigRequest isn't required.
2017-09-05 16:11:02 +02:00
Lonami Exo
d5cd59de8a Update to v0.13.1 2017-09-04 20:34:05 +02:00
Lonami Exo
15fd5390ae Optimize imports 2017-09-04 17:18:33 +02:00
Lonami Exo
97cab7347b Make lint happier 2017-09-04 17:10:04 +02:00
Lonami Exo
dc238df2e0 Update to v0.13 2017-09-04 12:18:45 +02:00
Lonami Exo
6f0bd14c2f Use an Enum for the ConnectionMode and support specifying it 2017-09-04 11:24:10 +02:00
Lonami Exo
62a52679f4 Ensure the state of the requests is clean before invoking them 2017-09-03 13:45:13 +02:00
Lonami Exo
4de4026bb3 Move the "constant read" thread to the main TelegramClient 2017-09-03 09:56:10 +02:00
Lonami Exo
9bc1f64efe Move update handling to the MtProtoSender, being functional again 2017-09-02 21:46:44 +02:00
Lonami Exo
21eaf8bd72 Allow setting whether the MtProtoSender should use constant_read 2017-09-02 21:27:11 +02:00
Lonami Exo
863d2e8368 Make confirm_received a flag, avoid race conditions, fix bg RPCError
There was a race condition between TelegramBareClient.invoke
receiving part and MtProtoSender._handle_rpc_result actually
reading the result after setting request.confirmed = True.

The .confirmed is now a threading.Event to avoid the sleep(0.1).

RPC errors have been moved inside the request so they're not
raised on a background thread anymore.
2017-09-02 20:41:00 +02:00
Lonami Exo
b908296efa Remove unused TcpClien.read(timeout=...) param, change other accessors 2017-09-02 19:33:42 +02:00
Lonami Exo
43b79c3d36 Add a thread to constantly read messages from the network 2017-09-02 18:27:22 +02:00
Lonami Exo
22673aec0e Replace the old Session+pickle with JsonSession (name change) 2017-08-29 15:59:08 +02:00
Lonami Exo
82304b18eb Attempt at supporting IPv6 (#211 and #112) 2017-08-29 13:49:41 +02:00
Lonami Exo
fa22a3f848 Create a centralized Connection class, replaces TcpTransport (#112) 2017-08-28 21:23:31 +02:00
Lonami Exo
2c6377e069 Update to v0.12.2 2017-08-28 17:29:08 +02:00
Lonami Exo
06b2d5d786 Fix CDN client not being disconnected 2017-08-28 16:33:23 +02:00
Lonami Exo
8afcd0b91f Turn HashChecker into CdnDecrypter to abstract CDN-specific aspects 2017-08-28 16:25:10 +02:00
Lonami Exo
b504ce14bc Verify the files downloaded from CDNs and raise on sha256 mismatch 2017-08-28 14:17:31 +02:00
Lonami Exo
2e55998d7f Update to v0.12.1 2017-08-24 19:09:37 +02:00