net_ip2addr(client->user->conn.remote_ip));
}
str_append_c(title, ' ');
- str_append(title, client_state_get_name(client));
+ str_append(title, smtp_server_state_names[client->state.state]);
+ if (client->state.args != NULL && *client->state.args != '\0') {
+ str_append_c(title, ' ');
+ str_append(title, client->state.args);
+ }
break;
default:
str_printfa(title, "%u connections", submission_client_count);
static void client_state_reset(struct client *client)
{
+ i_free(client->state.args);
i_stream_unref(&client->state.data_input);
pool_unref(&client->state.pool);
static void
client_connection_state_changed(void *context ATTR_UNUSED,
- enum smtp_server_state new_state ATTR_UNUSED,
- const char *new_args ATTR_UNUSED)
+ enum smtp_server_state new_state,
+ const char *new_args)
{
+ struct client *client = context;
+
+ i_free(client->state.args);
+
+ client->state.state = new_state;
+ client->state.args = i_strdup(new_args);
+
if (submission_client_count == 1)
submission_refresh_proctitle();
}
if (conn != NULL) {
stats = smtp_server_connection_get_stats(conn);
client->stats = *stats;
- client->last_state =
- smtp_server_connection_get_state(conn, NULL);
}
client_disconnect(client, NULL, reason);
}
client_destroy(client, NULL, NULL);
}
-const char *client_state_get_name(struct client *client)
-{
- enum smtp_server_state state;
-
- if (client->conn == NULL)
- state = client->last_state;
- else
- state = smtp_server_connection_get_state(client->conn, NULL);
- return smtp_server_state_names[state];
-}
-
static const char *client_stats(struct client *client)
{
const char *trans_id = (client->conn == NULL ? "" :
i_info("Disconnect from %s: %s %s (state=%s)",
client_remote_id(client),
log_reason, client_stats(client),
- client_state_get_name(client));
+ smtp_server_state_names[client->state.state]);
conn = client->conn;
client->conn = NULL;
if (conn != NULL) {
- client->last_state =
- smtp_server_connection_get_state(conn, NULL);
smtp_server_connection_terminate(&conn,
(enh_code == NULL ? "4.0.0" : enh_code), reason);
}
struct client_state {
pool_t pool;
+ enum smtp_server_state state;
+ char *args;
struct submission_backend *backend;
struct istream *data_input;
const struct submission_settings *set;
struct smtp_server_connection *conn;
- enum smtp_server_state last_state;
struct client_state state;
ARRAY(struct submission_backend *) pending_backends;
ARRAY(struct submission_recipient *) rcpt_to;
void client_default_backend_started(struct client *client,
enum smtp_capability caps);
-const char *client_state_get_name(struct client *client);
-
uoff_t client_get_max_mail_size(struct client *client);
void client_add_extra_capability(struct client *client, const char *capability,