#include "strescape.h"
#include "str-sanitize.h"
#include "time-util.h"
+#include "process-title.h"
#include "master-service.h"
#include "mail-storage-service.h"
#include "imap-client.h"
i_close_fd(&fd_client);
return -1;
}
+ process_title_set("[unhibernating]");
/* NOTE: before client_create_from_input() on failures we need to close
fd_client, but afterward it gets closed by client_destroy() */
/* read the first file descriptor that we can */
i_stream_unix_set_read_fd(client->conn.input);
+
+ imap_refresh_proctitle();
}
static struct connection_settings client_set = {
.idle_timeout = imap_master_client_idle_timeout,
};
+bool imap_master_clients_refresh_proctitle(void)
+{
+ switch (master_clients->connections_count) {
+ case 0:
+ return FALSE;
+ case 1:
+ process_title_set("[waiting on unhibernate client]");
+ return TRUE;
+ default:
+ process_title_set(t_strdup_printf("[unhibernating %u clients]",
+ master_clients->connections_count));
+ return TRUE;
+ }
+}
+
void imap_master_clients_init(void)
{
master_clients = connection_list_init(&client_set, &client_vfuncs);
#define IMAP_MASTER_CLIENT_H
void imap_master_client_create(int fd);
+bool imap_master_clients_refresh_proctitle(void);
void imap_master_clients_init(void);
void imap_master_clients_deinit(void);
#define IMAP_PROCTITLE_PREFERRED_LEN 80
struct client *client;
struct client_command_context *cmd;
- string_t *title = t_str_new(128);
bool wait_output;
if (!verbose_proctitle)
return;
+ if (imap_client_count == 0) {
+ if (imap_master_clients_refresh_proctitle())
+ return;
+ }
+ string_t *title = t_str_new(128);
str_append_c(title, '[');
switch (imap_client_count) {
case 0:
imap_features_init();
clients_init();
imap_master_clients_init();
+ /* this is needed before settings are read */
+ verbose_proctitle = !IS_STANDALONE() &&
+ getenv(MASTER_VERBOSE_PROCTITLE_ENV) != NULL;
const char *error;
if (t_abspath(auth_socket_path, &login_set.auth_socket_path, &error) < 0)