From e18a630fd0833d040661ff66f0f6b07210b762a2 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Thu, 30 Aug 2018 19:52:18 +0200 Subject: [PATCH] Fix "Connection from (null)" log message. --- src/connection.h | 1 - src/net_socket.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/connection.h b/src/connection.h index acab4484..9b272dc8 100644 --- a/src/connection.h +++ b/src/connection.h @@ -57,7 +57,6 @@ typedef struct connection_t { char *name; /* name he claims to have */ union sockaddr_t address; /* his real (internet) ip */ - char *hostname; /* the hostname of its real ip */ int protocol_major; /* used protocol */ int protocol_minor; /* used protocol */ diff --git a/src/net_socket.c b/src/net_socket.c index 01ef9429..1e981af6 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -545,7 +545,7 @@ begin: } if(c->socket == -1) { - logger(mesh, MESHLINK_ERROR, "Creating socket for %s at %s failed: %s", c->name, c->hostname, sockstrerror(sockerrno)); + logger(mesh, MESHLINK_ERROR, "Creating socket for %s at %s failed: %s", c->name, hostname, sockstrerror(sockerrno)); free_connection(c); free(hostname); goto begin; @@ -725,7 +725,7 @@ void handle_new_meta_connection(event_loop_t *loop, void *data, int flags) { c->last_ping_time = mesh->loop.now.tv_sec; char *hostname = sockaddr2hostname(&sa); - logger(mesh, MESHLINK_INFO, "Connection from %s", c->hostname); + logger(mesh, MESHLINK_INFO, "Connection from %s", hostname); free(hostname); io_add(&mesh->loop, &c->io, handle_meta_io, c, c->socket, IO_READ); -- 2.39.5