Use a macro to replace "Server shutting down" texts in different services.
/* We're not in the lib-http/server's connection destroy
callback. */
http_server_connection_close(&conn->http_conn,
- "Server shutting down");
+ MASTER_SERVICE_SHUTTING_DOWN_MSG);
}
}
static void imap_client_kick(struct imap_client *client)
{
imap_client_io_activate_user(client);
- o_stream_nsend_str(client->output, "* BYE Server shutting down.\r\n");
- imap_client_destroy(&client, "Server shutting down");
+ o_stream_nsend_str(client->output,
+ "* BYE "MASTER_SERVICE_SHUTTING_DOWN_MSG".\r\n");
+ imap_client_destroy(&client, MASTER_SERVICE_SHUTTING_DOWN_MSG);
}
void imap_clients_init(void)
void clients_destroy_all(void)
{
- while (imap_urlauth_clients != NULL)
- client_destroy(imap_urlauth_clients, "Server shutting down");
+ while (imap_urlauth_clients != NULL) {
+ client_destroy(imap_urlauth_clients,
+ MASTER_SERVICE_SHUTTING_DOWN_MSG);
+ }
}
void client_kick(struct client *client)
{
mail_storage_service_io_activate_user(client->service_user);
- if (client->output_cmd_lock == NULL)
- client_send_line(client, "* BYE Server shutting down.");
- client_destroy(client, "Server shutting down");
+ if (client->output_cmd_lock == NULL) {
+ client_send_line(client,
+ "* BYE "MASTER_SERVICE_SHUTTING_DOWN_MSG".");
+ }
+ client_destroy(client, MASTER_SERVICE_SHUTTING_DOWN_MSG);
}
void clients_destroy_all(void)
return;
mail_storage_service_io_activate_user(client->service_user);
- client_send_line(client, "* BYE Server shutting down.");
- client_destroy(client, "Server shutting down");
+ client_send_line(client, "* BYE "MASTER_SERVICE_SHUTTING_DOWN_MSG".");
+ client_destroy(client, MASTER_SERVICE_SHUTTING_DOWN_MSG);
}
static void imap_die(void)
{
if (conn->request_queue_head == NULL ||
conn->request_queue_head->state == HTTP_SERVER_REQUEST_STATE_NEW) {
- http_server_connection_close(&conn, "Server shutting down");
+ http_server_connection_close(&conn,
+ MASTER_SERVICE_SHUTTING_DOWN_MSG);
return TRUE;
}
return FALSE;
#include <unistd.h> /* for getopt() opt* variables */
#include <stdio.h> /* for getopt() opt* variables in Solaris */
+#define MASTER_SERVICE_SHUTTING_DOWN_MSG "Server shutting down"
+
enum master_service_flags {
/* stdin/stdout already contains a client which we want to serve */
MASTER_SERVICE_FLAG_STD_CLIENT = 0x01,
mail_storage_service_io_activate_user(client->service_user);
if (client->cmd == NULL) {
client_send_line(client,
- "-ERR [SYS/TEMP] Server shutting down.");
+ "-ERR [SYS/TEMP] "MASTER_SERVICE_SHUTTING_DOWN_MSG".");
}
- client_destroy(client, "Server shutting down");
+ client_destroy(client, MASTER_SERVICE_SHUTTING_DOWN_MSG);
}
void clients_destroy_all(void)
void client_kick(struct client *client)
{
mail_storage_service_io_activate_user(client->service_user);
- client_destroy(&client, "4.3.2", "Server shutting down");
+ client_destroy(&client, "4.3.2", MASTER_SERVICE_SHUTTING_DOWN_MSG);
}
void clients_destroy_all(void)