[#2846] Fix splitting IPv6 from external IP alert message

This commit is contained in:
Calum Lind 2016-10-26 23:24:10 +01:00
parent 3f72905b3f
commit 257c31c05f
1 changed files with 6 additions and 2 deletions

View File

@ -1273,9 +1273,13 @@ class TorrentManager(component.Component):
"""Alert handler for libtorrent external_ip_alert
Note:
alert.message format is: "external IP received: 0.0.0.0"
The alert.message IPv4 address format is:
'external IP received: 0.0.0.0'
and IPv6 address format is:
'external IP received: 0:0:0:0:0:0:0:0'
"""
external_ip = decode_string(alert.message()).split(':')[1].strip()
external_ip = decode_string(alert.message()).split(' ')[-1]
log.info("on_alert_external_ip: %s", external_ip)
component.get("EventManager").emit(ExternalIPEvent(external_ip))