Accept conn_failed as valid state on timeouts

When the internet connection is lost, in some cases libpurple can return a file descriptor without any error that is still not writable or readable. In that case, the connection would remain in the state conn_error until the next ping timeout, which has been causing an assertion error until now.
This commit is contained in:
mjentsch 2014-11-21 11:46:55 +01:00
parent 3e4fc8513f
commit 54f6a29456

View file

@ -67,7 +67,7 @@ static int ping_alarm (gpointer arg) {
struct connection *c = arg;
struct tgl_state *TLS = c->TLS;
vlogprintf (E_DEBUG + 2,"ping alarm\n");
assert (c->state == conn_ready || c->state == conn_connecting);
assert (c->state == conn_failed || c->state == conn_ready || c->state == conn_connecting);
if (tglt_get_double_time () - c->last_receive_time > 6 * PING_TIMEOUT) {
vlogprintf (E_WARNING, "fail connection: reason: ping timeout\n");
c->state = conn_failed;