Free all pending timers and queries after erroring
This commit is contained in:
parent
ce96381ef9
commit
f0447fa958
4 changed files with 15 additions and 0 deletions
|
@ -1856,6 +1856,9 @@ void mtproto_close(struct mtproto_connection *mtp) {
|
|||
|
||||
// remove all ping timer that point to this connection
|
||||
stop_ping_timer (mtp->connection);
|
||||
|
||||
//
|
||||
mtp->connection->session->c = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
5
net.c
5
net.c
|
@ -619,6 +619,11 @@ void connections_poll_result (struct pollfd *fds, int max) {
|
|||
}
|
||||
|
||||
int send_all_acks (struct session *S) {
|
||||
logprintf ("send_all_acks()\n");
|
||||
if (!S->c) {
|
||||
logprintf ("WARNING: cannot send acks, session has no active connection");
|
||||
return -1;
|
||||
}
|
||||
struct mtproto_connection *mt = S->c->mtconnection;
|
||||
|
||||
clear_packet (mt);
|
||||
|
|
|
@ -3075,6 +3075,9 @@ void do_update_typing (struct telegram *instance, peer_id_t id) {
|
|||
|
||||
int telegram_has_output (struct telegram *instance)
|
||||
{
|
||||
if (!instance->connection) {
|
||||
return 0;
|
||||
}
|
||||
if (instance->session_state == STATE_READY) {
|
||||
return tree_count_query (instance->queries_tree) > 0;
|
||||
}
|
||||
|
|
|
@ -160,6 +160,10 @@ void telegram_change_state (struct telegram *instance, int state, void *data)
|
|||
assert (instance->config->proxy_request_cb);
|
||||
// tell the proxy to close all connections
|
||||
instance->config->proxy_close_cb (instance, instance->connection->connection->fd);
|
||||
|
||||
// remove all left over queries and timers
|
||||
free_timers (instance);
|
||||
free_queries (instance);
|
||||
|
||||
// start a new connection to the demanded data center. The pointer to the
|
||||
// new dc should was already updated by the on_error function of the query
|
||||
|
|
Loading…
Add table
Reference in a new issue