From db449e3cb3f89ae3cab2c7b232357c81367900be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 28 Sep 2017 23:52:39 +0200 Subject: [PATCH] Fix implementation of TCPListener.bindAddress. --- source/vibe/core/net.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/vibe/core/net.d b/source/vibe/core/net.d index 837ff6d..7ee77d6 100644 --- a/source/vibe/core/net.d +++ b/source/vibe/core/net.d @@ -705,7 +705,6 @@ struct TCPListener { // stopListening() needs to keep working. private { StreamListenSocketFD m_socket; - NetworkAddress m_bindAddress; } this(StreamListenSocketFD socket) @@ -718,7 +717,11 @@ struct TCPListener { /// The local address at which TCP connections are accepted. @property NetworkAddress bindAddress() { - return m_bindAddress; + NetworkAddress ret; + scope ra = new RefAddress(ret.sockAddr, ret.sockAddrMaxLen); + enforce(eventDriver.sockets.getLocalAddress(m_socket, ra), + "Failed to query bind address of listening socket."); + return ret; } /// Stops listening and closes the socket.