return str_c(str);
}
+static const char *client_get_disconnect_reason(struct client *client)
+{
+ errno = client->input->stream_errno != 0 ?
+ client->input->stream_errno :
+ client->output->stream_errno;
+ return errno == 0 || errno == EPIPE ? "Connection closed" :
+ t_strdup_printf("Connection closed: %m");
+}
+
void client_destroy(struct client *client, const char *reason)
{
if (!client->disconnected) {
if (reason == NULL)
- reason = "Disconnected";
+ reason = client_get_disconnect_reason(client);
i_info("%s %s", reason, client_stats(client));
}