Logs: show IPv6 address + port correctly

Closes #79
This commit is contained in:
Neil Booth 2016-12-18 08:06:56 +09:00
parent 6679eea04c
commit 378372e666

View File

@ -177,7 +177,10 @@ class JSONRPC(asyncio.Protocol, LoggedClass):
return 'unknown'
if for_log and self.anon_logs:
return 'xx.xx.xx.xx:xx'
return '{}:{}'.format(self.peer_info[0], self.peer_info[1])
if ':' in self.peer_info[0]:
return '[{}]:{}'.format(self.peer_info[0], self.peer_info[1])
else:
return '{}:{}'.format(self.peer_info[0], self.peer_info[1])
def connection_made(self, transport):
'''Handle an incoming client connection.'''