diff --git a/mtproto-client.c b/mtproto-client.c index f9ac832..6293bb8 100644 --- a/mtproto-client.c +++ b/mtproto-client.c @@ -1153,6 +1153,9 @@ int rpc_execute (struct connection *c, int op, int len) { int Response_len = len; + if (verbosity >= 2) { + logprintf ("Response_len = %d\n", Response_len); + } assert (read_in (c, Response, Response_len) == Response_len); Response[Response_len] = 0; if (verbosity >= 2) { diff --git a/net.c b/net.c index f806a38..6fba56e 100644 --- a/net.c +++ b/net.c @@ -298,12 +298,12 @@ void try_rpc_read (struct connection *c) { unsigned t = 0; assert (read_in_lookup (c, &len, 1) == 1); if (len >= 1 && len <= 0x7e) { - if (c->in_bytes < (int)(4 * len)) { return; } + if (c->in_bytes < (int)(1 + 4 * len)) { return; } } else { if (c->in_bytes < 4) { return; } assert (read_in_lookup (c, &len, 4) == 4); len = (len >> 8); - if (c->in_bytes < (int)(4 * len)) { return; } + if (c->in_bytes < (int)(4 + 4 * len)) { return; } len = 0x7f; } diff --git a/queries.c b/queries.c index bfcd33f..a688e31 100644 --- a/queries.c +++ b/queries.c @@ -56,6 +56,9 @@ struct query *query_get (long long id) { int alarm_query (struct query *q) { assert (q); + if (verbosity) { + logprintf ("Alarm query %lld\n", q->msg_id); + } q->ev.timeout = get_double_time () + QUERY_TIMEOUT; insert_event_timer (&q->ev); return 0;