diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2021-09-30 19:57:45 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2021-10-03 14:16:57 +0100 |
commit | a5a7da4a1a52a351e7c800be896d0f27eac72ec2 (patch) | |
tree | 69f30eeb6a326513fa2853221d599dbd0253c7ab | |
parent | 1e6cc0394666ae95e9521f1016d07d56a3ed43a5 (diff) | |
download | deluge-a5a7da4a1a52a351e7c800be896d0f27eac72ec2.tar.gz deluge-a5a7da4a1a52a351e7c800be896d0f27eac72ec2.tar.bz2 deluge-a5a7da4a1a52a351e7c800be896d0f27eac72ec2.zip |
[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
-rw-r--r-- | deluge/core/torrentmanager.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 67c4cafd1..365f37233 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -1626,18 +1626,9 @@ class TorrentManager(component.Component): self.handle_torrents_status_callback(self.torrents_status_requests.pop()) def on_alert_external_ip(self, alert): - """Alert handler for libtorrent external_ip_alert - - Note: - 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)) + """Alert handler for libtorrent external_ip_alert""" + log.info('on_alert_external_ip: %s', alert.external_address) + component.get('EventManager').emit(ExternalIPEvent(alert.external_address)) def on_alert_performance(self, alert): """Alert handler for libtorrent performance_alert""" |