diff --git a/include/evio.h b/include/evio.h index 5e609e67623cc5291b8401ec32f41eb7ab37d5eb..3f3a5e2c21f1ed641aa0536385bf1b838a668576 100644 --- a/include/evio.h +++ b/include/evio.h @@ -62,6 +62,8 @@ struct evio_service { /** Service name. E.g. 'primary', 'secondary', etc. */ char name[SERVICE_NAME_MAXLEN]; + /** Bind IP address, useful for logging */ + char host[SERVICE_NAME_MAXLEN]; /** Interface/port to bind to */ struct sockaddr_in addr; diff --git a/src/evio.cc b/src/evio.cc index 23af2a45aa1d21b0f72164da4a0b42c7ec85f97c..de66eb1dcbfcb3061312744cbbba5bfb39d5dbdb 100644 --- a/src/evio.cc +++ b/src/evio.cc @@ -173,12 +173,6 @@ evio_service_port(struct evio_service *service) return ntohs(service->addr.sin_port); } -static inline const char * -evio_service_name(struct evio_service *service) -{ - return service->name; -} - /** * A callback invoked by libev when acceptor socket is ready. * Accept the socket, initialize it and pass to the on_accept @@ -234,8 +228,10 @@ evio_service_bind_and_listen(struct evio_service *service) close(fd); return -1; } - say_info("bound to %s port %i", evio_service_name(service), - evio_service_port(service)); + say_info("bound to %s port %i, ip %s", + service->name, + evio_service_port(service), + service->host); /* Invoke on_bind callback if it is set. */ if (service->on_bind) @@ -275,6 +271,7 @@ evio_service_init(struct evio_service *service, const char *name, { memset(service, 0, sizeof(struct evio_service)); snprintf(service->name, sizeof(service->name), "%s", name); + snprintf(service->host, sizeof(service->host), "%s", host); service->addr.sin_family = AF_INET; service->addr.sin_port = htons(port); @@ -309,7 +306,7 @@ evio_service_start(struct evio_service *service) /* Try again after a delay. */ say_warn("%s port %i is already in use, will " "retry binding after %lf seconds.", - evio_service_name(service), + service->name, evio_service_port(service), BIND_RETRY_DELAY); ev_timer_set(&service->timer, diff --git a/src/tarantool.cc b/src/tarantool.cc index d29fb188f892f34545de06c85e6c9f79b1ac7094..28393050b283c22f05912f5b77f17e902668b339 100644 --- a/src/tarantool.cc +++ b/src/tarantool.cc @@ -142,6 +142,10 @@ title(const char *role, const char *fmt, ...) if (*pptr) bufptr += snprintf(bufptr, bufend - bufptr, " %s: %i", *nptr, *pptr); + if (strlen(cfg.bind_ipaddr)) { + bufptr += snprintf(bufptr, bufend - bufptr, + ", ip: %s", cfg.bind_ipaddr); + } set_proc_title(buf); }