From 5cb5b1cfd285b9d302fe0170f8802b10eb09d912 Mon Sep 17 00:00:00 2001 From: vvaltman Date: Mon, 15 Sep 2014 12:45:17 +0400 Subject: [PATCH] Run get_differece on new_session_created --- loop.c | 2 ++ mtproto-client.c | 4 +++- tgl.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/loop.c b/loop.c index b3e9de3..9c0b4c7 100644 --- a/loop.c +++ b/loop.c @@ -586,6 +586,7 @@ void dlist_cb (void *callback_extra, int success, int size, tgl_peer_id_t peers[ int loop (void) { //on_start (); tgl_set_callback (&upd_cb); + //tgl_state.temp_key_expire_time = 60; tgl_init (); if (binlog_enabled) { @@ -731,6 +732,7 @@ int loop (void) { tgl_do_get_difference (sync_from_start, get_difference_callback, 0); net_loop (0, dgot); assert (!(tgl_state.locks & TGL_LOCK_DIFF)); + tgl_state.started = 1; if (wait_dialog_list) { d_got_ok = 0; tgl_do_get_dialog_list (dlist_cb, 0); diff --git a/mtproto-client.c b/mtproto-client.c index 5e82d9a..89d44b8 100644 --- a/mtproto-client.c +++ b/mtproto-client.c @@ -906,7 +906,9 @@ static void work_new_session_created (struct connection *c, long long msg_id UU) //DC->session_id = fetch_long (); fetch_long (); // unique_id tgl_state.net_methods->get_dc (c)->server_salt = fetch_long (); - + if (tgl_state.started && !(tgl_state.locks & TGL_LOCK_DIFF)) { + tgl_do_get_difference (0, 0, 0); + } } static void work_msgs_ack (struct connection *c UU, long long msg_id UU) { diff --git a/tgl.h b/tgl.h index 7f74b30..1ab6768 100644 --- a/tgl.h +++ b/tgl.h @@ -135,6 +135,7 @@ struct tgl_state { int unread_messages; int active_queries; int max_msg_id; + int started; long long locks; struct tgl_dc *DC_list[TGL_MAX_DC_NUM];