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
Andrey Egorov
f37b9ed20e
Fix new salt not being saved to session file ( #362 )
2017-10-20 16:48:54 +02:00
Andrey Egorov
e349910eb9
Fix attribute access order being swapped ( #353 )
2017-10-18 15:34:04 +02:00
Andrey Egorov
16cf94c9ad
Fix ._clear_all_pending failing due to a wrong call ( #352 )
2017-10-18 14:47:03 +02:00
Lonami Exo
adb79b21cf
Replace .to_bytes() with the special .__bytes__ function
2017-10-17 19:54:59 +02:00
Lonami Exo
63dfb1e3ea
Fix processing messages pending of acknowledge many times
2017-10-17 10:15:13 +02:00
Andrey Egorov
ed77ba6f8f
Likely fix .log_out crashing "calling Event" ( #349 )
2017-10-17 00:39:04 +02:00
Lonami Exo
bec5f9fb89
Add stub methods for more server responses
2017-10-12 21:09:09 +02:00
Lonami Exo
bff2e6981e
Fix ._pop_request_of_type failing on not-found requests
2017-10-12 18:03:10 +02:00
Lonami Exo
7bb7cb039f
Fix handle RpcResult not always returning a bool
2017-10-12 17:58:37 +02:00
Lonami Exo
0c1170ee61
Replace hardcoded reads with TLObject's .read()
2017-10-12 16:40:59 +02:00
Lonami Exo
301da16f29
Fix pong response not reading all data from the buffer
2017-10-11 21:09:09 +02:00
Lonami Exo
9d394ab18b
Send MsgsAck in the same container along with the requests
2017-10-06 11:36:39 +02:00
Lonami Exo
e717256937
Always use session ip address and port when connecting
2017-10-01 19:26:20 +02:00
Lonami Exo
36dabc4928
Process entities from the MtProtoSender instead TelegramBareClient
...
This way, update objects will also be processed when they occur.
2017-10-01 16:02:29 +02:00
Lonami Exo
0a567fcd7c
Make creating a new sender cleaner
2017-09-30 12:08:06 +02:00
Lonami Exo
5da300ca84
Make MtProtoSender not thread-safe
...
Rationale: a new connection should be spawned if one desires to
send and receive requests in parallel, which would otherwise cause
one of either threads to lock.
2017-09-30 11:50:11 +02:00
Lonami Exo
56103845de
Fix LogOutRequest consuming all retries ( #270 )
2017-09-29 13:58:15 +02:00
Lonami Exo
afc4bd9cab
Rename constructor/subclass_of_id to upper case, keep only static
2017-09-29 13:11:33 +02:00
Lonami Exo
cc337328c6
Rename handmade Message class to TLMessage to avoid confusion
2017-09-28 11:59:24 +02:00
Lonami Exo
833aeb86eb
Fix auth_key is unsigned
2017-09-27 21:04:52 +02:00
Lonami Exo
bd3dd371a2
Create a proper Message class (msg_id, seqno, body; only .to_bytes())
2017-09-27 21:01:20 +02:00
Lonami Exo
6df9fc558e
Create and use a new GzipPacked class, also when sending
2017-09-27 13:46:53 +02:00
Lonami Exo
efca981312
Fix adding a request twice (or container) to ._pending_receive
2017-09-27 13:26:35 +02:00
Lonami Exo
b83cd98ba0
Replace TLObject.on_send with the new .to_bytes()
...
This also replaces some int.to_bytes() calls with a faster
struct.pack (up to x4 faster). This approach is also around
x3 faster than creating a BinaryWriter just to serialize a
TLObject as bytes.
2017-09-26 14:36:02 +02:00
Lonami Exo
f233110732
Allow sending several requests at once through new MessageContainer
2017-09-25 20:52:27 +02:00
Lonami Exo
4a8e5c865a
Detect BrokenAuthKeyError on MtProtoSender._decode_msg
2017-09-22 13:32:00 +02:00
Lonami Exo
ffadcd029f
Save the session much less often (doable because 151e162
)
2017-09-21 19:12:46 +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
2a3e5e5ed2
Handle BufferError's more gracefully
2017-09-17 19:39:41 +02:00
Lonami Exo
12a39873f1
Workaround msg_seqno too low/high ( closes #95 )
2017-09-14 11:50:38 +02:00
Lonami Exo
a2fdd4b196
Ignore InvalidChecksumError's
2017-09-11 11:04:19 +02:00
Lonami Exo
25bbb20b0c
Use RLocks properly on MtProtoSender (only needed on net IO)
2017-09-07 21:32:46 +02:00
Lonami Exo
d4f36162cd
Create and use UpdateState to .process() unhandled TLObjects
2017-09-07 18:49:08 +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
f8f389c850
Fix ack requests removing pending requests when they shouldn't
2017-09-03 11:21:42 +02:00
Lonami Exo
db6fd4bdc2
Fix RPC errors being ignored due to modifying the wrong attribute
2017-09-03 11:19:28 +02:00
Lonami Exo
83f3f66113
Fix MtProtoSender never clearing self._pending_receive requests
2017-09-03 10:50:55 +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
fa22a3f848
Create a centralized Connection class, replaces TcpTransport ( #112 )
2017-08-28 21:23:31 +02:00
Lonami Exo
00b5b5021b
Report errors to pwrtelegram.xyz by default
2017-08-25 15:34:20 +02:00