bool bad_done, idle_done;
bool unhibernate_queued;
bool input_pending;
+ bool shutdown_fd_on_destroy;
};
static struct imap_client *imap_clients;
imap_client_unhibernate_failed(&client, error);
return;
}
+ /* If unhibernation fails after this, shutdown() the fd to make sure
+ the imap process won't later on finish unhibernation after all and
+ cause confusion. */
+ client->shutdown_fd_on_destroy = TRUE;
i_assert(ret > 0);
o_stream_nsend(output, str_data(str) + 1, str_len(str) - 1);
}
/* failed - FIXME: retry later? */
imap_client_unhibernate_failed(&client, line+1);
} else {
+ client->shutdown_fd_on_destroy = FALSE;
imap_client_destroy(&client, NULL);
}
}
if (client->state.tag != NULL)
i_free(client->state.tag);
+ if (client->shutdown_fd_on_destroy) {
+ if (shutdown(client->fd, SHUT_RDWR) < 0)
+ e_error(client->event, "shutdown() failed: %m");
+ }
+
DLLIST_REMOVE(&imap_clients, client);
imap_client_stop(client);
i_stream_destroy(&client->input);