Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/majn/tgl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvvaltman <vvaltman@neon>2014-12-13 19:00:00 +0300
committervvaltman <vvaltman@neon>2014-12-13 19:00:00 +0300
commit47cf13e3b45aa8c56ed825617129ffcf3ba8c8b6 (patch)
treec49e6d7c7430161a6168c3c316ac921698d9d20e
parent1c27b28454c035e8520da5bb4de40e421de72035 (diff)
try to fix time issues
-rw-r--r--mtproto-client.c5
-rw-r--r--tgl-layout.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/mtproto-client.c b/mtproto-client.c
index a92869d..a89db9d 100644
--- a/mtproto-client.c
+++ b/mtproto-client.c
@@ -190,11 +190,14 @@ static int rpc_send_packet (struct tgl_state *TLS, struct connection *c) {
TLS->net_methods->incr_out_packet_num (c);
struct tgl_dc *DC = TLS->net_methods->get_dc (c);
long long next_msg_id = (long long) ((1LL << 32) * get_server_time (DC)) & -4;
+ struct tgl_session *S = TLS->net_methods->get_session (c);
+ unenc_msg_header.out_msg_id = S->last_msg_id;
if (next_msg_id <= unenc_msg_header.out_msg_id) {
unenc_msg_header.out_msg_id += 4;
} else {
unenc_msg_header.out_msg_id = next_msg_id;
}
+ S->last_msg_id = unenc_msg_header.out_msg_id;
unenc_msg_header.msg_len = len;
int total_len = len + 20;
@@ -240,7 +243,6 @@ static int send_req_pq_packet (struct tgl_state *TLS, struct connection *c) {
assert (D->state == st_init);
tglt_secure_random (D->nonce, 16);
- unenc_msg_header.out_msg_id = 0;
clear_packet ();
out_int (CODE_req_pq);
out_ints ((int *)D->nonce, 4);
@@ -255,7 +257,6 @@ static int send_req_pq_temp_packet (struct tgl_state *TLS, struct connection *c)
assert (D->state == st_authorized);
tglt_secure_random (D->nonce, 16);
- unenc_msg_header.out_msg_id = 0;
clear_packet ();
out_int (CODE_req_pq);
out_ints ((int *)D->nonce, 4);
diff --git a/tgl-layout.h b/tgl-layout.h
index 0c4661f..395ff6b 100644
--- a/tgl-layout.h
+++ b/tgl-layout.h
@@ -60,6 +60,7 @@ enum tgl_dc_state {
struct tgl_session {
struct tgl_dc *dc;
long long session_id;
+ long long last_msg_id;
int seq_no;
int received_messages;
struct connection *c;