struct master_auth *auth;
unsigned int tag;
+ unsigned int client_pid, auth_id;
+ struct ip_addr remote_ip;
+ struct timeval create_time;
+
char *path;
int fd;
struct io *io;
i_free(conn);
}
+static void ATTR_FORMAT(2, 3)
+conn_error(struct master_auth_connection *conn, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ i_error("master(%s): %s (client-pid=%u, client-id=%u, rip=%s, created %u msecs ago, received %u/%zu bytes)",
+ conn->path, t_strdup_vprintf(fmt, args),
+ conn->client_pid, conn->auth_id, net_ip2addr(&conn->remote_ip),
+ timeval_diff_msecs(&ioloop_timeval, &conn->create_time),
+ conn->buf_pos, sizeof(conn->buf_pos));
+ va_end(args);
+}
+
void master_auth_deinit(struct master_auth **_auth)
{
struct master_auth *auth = *_auth;
sizeof(conn->buf) - conn->buf_pos);
if (ret <= 0) {
if (ret == 0 || errno == ECONNRESET) {
- i_error("read(%s) failed: Remote closed connection "
- "(destination service { process_limit } reached?)",
- conn->path);
+ conn_error(conn, "read() failed: Remote closed connection "
+ "(destination service { process_limit } reached?)");
} else {
if (errno == EAGAIN)
return;
- i_error("read(%s) failed: %m", conn->path);
+ conn_error(conn, "read() failed: %m");
}
master_auth_connection_deinit(&conn);
return;
conn->buf_pos = 0;
if (conn->tag != reply->tag)
- i_error("master(%s): Received reply with unknown tag %u",
- conn->path, reply->tag);
+ conn_error(conn, "Received reply with unknown tag %u", reply->tag);
else if (conn->callback == NULL) {
/* request aborted */
} else {
static void master_auth_connection_timeout(struct master_auth_connection *conn)
{
- i_error("master(%s): Auth request timed out (received %u/%u bytes)",
- conn->path, conn->buf_pos,
- (unsigned int)sizeof(conn->buf));
+ conn_error(conn, "Auth request timed out");
master_auth_connection_deinit(&conn);
}
conn = i_new(struct master_auth_connection, 1);
conn->auth = auth;
+ conn->create_time = ioloop_timeval;
conn->callback = callback;
conn->context = context;
conn->path = params->socket_path != NULL ?
if (req.tag == 0)
req.tag = ++auth->tag_counter;
+ conn->client_pid = req.client_pid;
+ conn->auth_id = req.auth_id;
+ conn->remote_ip = req.remote_ip;
+
if (fstat(params->client_fd, &st) < 0)
i_fatal("fstat(auth dest fd) failed: %m");
req.ino = st.st_ino;
}
}
if (conn->fd == -1) {
- i_error("net_connect_unix(%s) failed: %m%s",
+ conn_error(conn, "net_connect_unix(%s) failed: %m%s",
conn->path, errno != EAGAIN ? "" :
" - http://wiki2.dovecot.org/SocketUnavailable");
master_auth_connection_deinit(&conn);
ret = fd_send(conn->fd, params->client_fd, buf->data, buf->used);
if (ret < 0) {
- i_error("fd_send(%s, %d) failed: %m", conn->path,
- params->client_fd);
+ conn_error(conn, "fd_send(fd=%d) failed: %m",
+ params->client_fd);
} else if ((size_t)ret != buf->used) {
- i_error("fd_send(%s) sent only %d of %d bytes",
- conn->path, (int)ret, (int)buf->used);
+ conn_error(conn, "fd_send() sent only %d of %d bytes",
+ (int)ret, (int)buf->used);
ret = -1;
}
if (ret < 0) {