[Core] Use external_address in external_ip alert handler
Unit tests are segfaulting and this is a result of a subsequent call to pop_alert creating a dangling pointer to alert.message method. Replace alert.message call with correct external_address property that doesn't require any parsing and wonder trigger segfault to expired pointer. https://github.com/arvidn/libtorrent/issues/6437
This commit is contained in:
parent
1e6cc03946
commit
a5a7da4a1a
|
@ -1626,18 +1626,9 @@ class TorrentManager(component.Component):
|
||||||
self.handle_torrents_status_callback(self.torrents_status_requests.pop())
|
self.handle_torrents_status_callback(self.torrents_status_requests.pop())
|
||||||
|
|
||||||
def on_alert_external_ip(self, alert):
|
def on_alert_external_ip(self, alert):
|
||||||
"""Alert handler for libtorrent external_ip_alert
|
"""Alert handler for libtorrent external_ip_alert"""
|
||||||
|
log.info('on_alert_external_ip: %s', alert.external_address)
|
||||||
Note:
|
component.get('EventManager').emit(ExternalIPEvent(alert.external_address))
|
||||||
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_bytes(alert.message()).split(' ')[-1]
|
|
||||||
log.info('on_alert_external_ip: %s', external_ip)
|
|
||||||
component.get('EventManager').emit(ExternalIPEvent(external_ip))
|
|
||||||
|
|
||||||
def on_alert_performance(self, alert):
|
def on_alert_performance(self, alert):
|
||||||
"""Alert handler for libtorrent performance_alert"""
|
"""Alert handler for libtorrent performance_alert"""
|
||||||
|
|
Loading…
Reference in New Issue