Commit e0fff964 authored by Vysheng's avatar Vysheng

Restart query on bad server salt

parent 4f494a57
...@@ -1052,6 +1052,16 @@ void work_packed (struct connection *c, long long msg_id) { ...@@ -1052,6 +1052,16 @@ void work_packed (struct connection *c, long long msg_id) {
in_gzip = 0; in_gzip = 0;
} }
void work_bad_server_salt (struct connection *c UU, long long msg_id UU) {
assert (fetch_int () == (int)CODE_bad_server_salt);
long long id = fetch_long ();
query_restart (id);
fetch_int (); // seq_no
fetch_int (); // error_code
long long new_server_salt = fetch_long ();
GET_DC(c)->server_salt = new_server_salt;
}
void rpc_execute_answer (struct connection *c, long long msg_id UU) { void rpc_execute_answer (struct connection *c, long long msg_id UU) {
if (verbosity >= 5) { if (verbosity >= 5) {
hexdump_in (); hexdump_in ();
...@@ -1085,6 +1095,9 @@ void rpc_execute_answer (struct connection *c, long long msg_id UU) { ...@@ -1085,6 +1095,9 @@ void rpc_execute_answer (struct connection *c, long long msg_id UU) {
case CODE_gzip_packed: case CODE_gzip_packed:
work_packed (c, msg_id); work_packed (c, msg_id);
return; return;
case CODE_bad_server_salt:
work_bad_server_salt (c, msg_id);
return;
} }
logprintf ( "Unknown message: \n"); logprintf ( "Unknown message: \n");
hexdump_in (); hexdump_in ();
......
...@@ -74,6 +74,14 @@ int alarm_query (struct query *q) { ...@@ -74,6 +74,14 @@ int alarm_query (struct query *q) {
return 0; return 0;
} }
void query_restart (long long id) {
struct query *q = query_get (id);
if (q) {
remove_event_timer (&q->ev);
alarm_query (q);
}
}
struct query *send_query (struct dc *DC, int ints, void *data, struct query_methods *methods, void *extra) { struct query *send_query (struct dc *DC, int ints, void *data, struct query_methods *methods, void *extra) {
assert (DC); assert (DC);
assert (DC->auth_key_id); assert (DC->auth_key_id);
......
...@@ -53,6 +53,7 @@ struct query *send_query (struct dc *DC, int len, void *data, struct query_metho ...@@ -53,6 +53,7 @@ struct query *send_query (struct dc *DC, int len, void *data, struct query_metho
void query_ack (long long id); void query_ack (long long id);
void query_error (long long id); void query_error (long long id);
void query_result (long long id); void query_result (long long id);
void query_restart (long long id);
void insert_event_timer (struct event_timer *ev); void insert_event_timer (struct event_timer *ev);
void remove_event_timer (struct event_timer *ev); void remove_event_timer (struct event_timer *ev);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment