struct timeout *to_throttle, *to_throttle_shrink;
bool reconnecting:1;
+ bool reconnect_ok:1;
bool idling:1;
bool idle_stopping:1;
bool idle_plus_waiting:1;
conn->name = i_strdup_printf("%s:%u", client->set.host,
client->set.port);
conn->literal.fd = -1;
+ conn->reconnect_ok = TRUE;
i_array_init(&conn->cmd_send_queue, 8);
i_array_init(&conn->cmd_wait_list, 32);
i_array_init(&conn->literal_files, 4);
{
if (conn->selected_box != NULL)
return imapc_client_mailbox_can_reconnect(conn->selected_box);
- else
- return conn->reconnect_command_count == 0;
+ else {
+ return conn->reconnect_command_count == 0 &&
+ conn->reconnect_ok;
+ }
}
static void imapc_connection_reconnect(struct imapc_connection *conn)
{
+ conn->reconnect_ok = FALSE;
+
if (conn->selected_box != NULL)
imapc_client_mailbox_reconnect(conn->selected_box);
else {
conn->selected_box->reconnect_ok = TRUE;
}
}
+ if (conn->reconnect_command_count == 0) {
+ /* we've successfully received replies to some commands. */
+ conn->reconnect_ok = TRUE;
+ }
imapc_connection_input_reset(conn);
imapc_command_reply_free(cmd, &reply);
imapc_command_send_more(conn);