From 27bf05f2fe7b2698816a939f38b5d1a0e22ac07c Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 15 Nov 2015 13:56:38 +0000 Subject: [PATCH] [#2738] [Core] Fix illegal argument with torrent_handle.set_max_connections --- deluge/core/torrent.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 4c094334e..d0b15bf1c 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -311,7 +311,17 @@ class Torrent(object): Args: max_connections (int): Maximum number of connections + + Note: + The minimum value for handle.max_connections is 2 (or -1 for unlimited connections). + This is enforced by libtorrent and values 0 or 1 raise an assert with lt debug builds. """ + + if max_connections == 0: + max_connections = -1 + elif max_connections == 1: + max_connections = 2 + self.options["max_connections"] = int(max_connections) self.handle.set_max_connections(max_connections)