Log the correct "auto" port number for listening sockets
When auto
is used for the port number for a listening socket, the message that gets logged after opening the socket incorrectly says port 0 instead of the actual port being used.
A contrived config like this
ControlPort auto
SocksPort 127.0.0.1:auto
ORPort 127.0.0.1:auto
ORPort [::1]:auto
gives log messages like this
Jan 21 12:38:05.741 [notice] Opening Socks listener on 127.0.0.1:0 Jan 21 12:38:05.741 [notice] Socks listener listening on port 22840. Jan 21 12:38:05.741 [notice] Opened Socks listener on 127.0.0.1:0 Jan 21 12:38:05.741 [notice] Opening Control listener on 127.0.0.1:0 Jan 21 12:38:05.741 [notice] Control listener listening on port 14414. Jan 21 12:38:05.741 [notice] Opened Control listener on 127.0.0.1:0 Jan 21 12:38:05.741 [notice] Opening OR listener on 127.0.0.1:0 Jan 21 12:38:05.741 [notice] OR listener listening on port 19719. Jan 21 12:38:05.741 [notice] Opened OR listener on 127.0.0.1:0 Jan 21 12:38:05.741 [notice] Opening OR listener on [::1]:0 Jan 21 12:38:05.742 [notice] OR listener listening on port 4298. Jan 21 12:38:05.742 [notice] Opened OR listener on [::1]:0
An upcoming PR will fix this so that the log messages will have the actual port numbers like this
Jan 21 12:38:57.709 [notice] Opening Socks listener on 127.0.0.1:0 Jan 21 12:38:57.709 [notice] Socks listener listening on port 5236. Jan 21 12:38:57.709 [notice] Opened Socks listener on 127.0.0.1:5236 Jan 21 12:38:57.709 [notice] Opening Control listener on 127.0.0.1:0 Jan 21 12:38:57.709 [notice] Control listener listening on port 14584. Jan 21 12:38:57.709 [notice] Opened Control listener on 127.0.0.1:14584 Jan 21 12:38:57.709 [notice] Opening OR listener on 127.0.0.1:0 Jan 21 12:38:57.709 [notice] OR listener listening on port 15220. Jan 21 12:38:57.709 [notice] Opened OR listener on 127.0.0.1:15220 Jan 21 12:38:57.709 [notice] Opening OR listener on [::1]:0 Jan 21 12:38:57.709 [notice] OR listener listening on port 36901. Jan 21 12:38:57.709 [notice] Opened OR listener on [::1]:36901
This was introduced by commit 27c868eff19dbcc208f6db66ec3e2de2104fa754 and occurs in 0.3.5.1-alpha.
Trac:
Username: kjak