diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2019-06-24 16:34:15 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2019-06-24 16:34:15 +0100 |
commit | 4b29436cd5eabf9af271f3fa6250cd7c91cdbc9d (patch) | |
tree | 2a928c8f3dbab9437516aa2b8729859d48767c0b | |
parent | 833b5a1f306dad600d0f64a5c897407ba1584830 (diff) | |
download | deluge-4b29436cd5eabf9af271f3fa6250cd7c91cdbc9d.tar.gz deluge-4b29436cd5eabf9af271f3fa6250cd7c91cdbc9d.tar.bz2 deluge-4b29436cd5eabf9af271f3fa6250cd7c91cdbc9d.zip |
[Core] Fix for peer.client UnicodeDecodeError
Some users have been reporting unhandled UnicodeDecodeErrors and the
traces show it occuring in the call to `peer.client`. Although unable to
replicate it seems prudent to put a try..except around the call to
ensure it does not break the UIs.
Refs: https://github.com/arvidn/libtorrent/issues/3858
Closes: #3279
-rw-r--r-- | deluge/core/torrent.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 10d5b4776..f40b58834 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -810,7 +810,11 @@ class Torrent(object): if peer.flags & peer.connecting or peer.flags & peer.handshake: continue - client = decode_bytes(peer.client) + try: + client = decode_bytes(peer.client) + except UnicodeDecodeError: + # libtorrent on Py3 can raise UnicodeDecodeError for peer_info.client + client = 'unknown' try: country = component.get('Core').geoip_instance.country_code_by_addr( |