From: Sebastian Harl Date: Sun, 22 Feb 2015 18:38:31 +0000 (+0100) Subject: frontend: Provide more details in the logs when shutting down a connection. X-Git-Tag: sysdb-0.8.0~168 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8b8cbad198df077add16bf08cefc7a6d50058d7d;p=sysdb.git frontend: Provide more details in the logs when shutting down a connection. --- diff --git a/src/frontend/connection.c b/src/frontend/connection.c index 117c6ae..ebc3b99 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -170,7 +170,18 @@ connection_destroy(sdb_object_t *obj) "(%zu byte%s left in buffer)", len, len == 1 ? "" : "s"); } - sdb_log(SDB_LOG_DEBUG, "frontend: Closing connection %s", obj->name); + if (conn->client_addr.ss_family == AF_UNIX) { + sdb_log(SDB_LOG_DEBUG, "frontend: Closing connection %s from peer %s", + obj->name, conn->username); + } + else { + char host[1024] = "", port[32] = ""; + getnameinfo((struct sockaddr *)&conn->client_addr, + conn->client_addr_len, host, sizeof(host), port, sizeof(port), + NI_NUMERICHOST | NI_NUMERICSERV); + sdb_log(SDB_LOG_DEBUG, "frontend: Closing connection %s from peer %s " + "at %s:%s", obj->name, conn->username, host, port); + } sdb_connection_close(conn); if (conn->username)