diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 80c7eb52e..c440aa46a 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -339,9 +339,9 @@ namespace } } -void connect_peer(torrent_handle& th, tuple ip, int source) +void connect_peer(torrent_handle& th, tuple ip, int source, int flags) { - th.connect_peer(tuple_to_endpoint(ip), source); + th.connect_peer(tuple_to_endpoint(ip), source, flags); } std::vector file_status(torrent_handle const& h) @@ -516,7 +516,7 @@ void bind_torrent_handle() .def("set_ratio", _(&torrent_handle::set_ratio)) .def("save_path", _(&torrent_handle::save_path)) #endif - .def("connect_peer", &connect_peer) + .def("connect_peer", &connect_peer, (arg("ip"), arg("source") = 0, arg("flags") = 0xd)) .def("set_max_uploads", _(&torrent_handle::set_max_uploads)) .def("max_uploads", _(&torrent_handle::max_uploads)) .def("set_max_connections", _(&torrent_handle::set_max_connections)) diff --git a/bindings/python/test.py b/bindings/python/test.py index 13348db0d..1f5b9292c 100644 --- a/bindings/python/test.py +++ b/bindings/python/test.py @@ -58,6 +58,10 @@ class test_torrent_handle(unittest.TestCase): # also test the overload that takes a list of piece->priority mappings self.h.prioritize_pieces([(0, 1)]) self.assertEqual(self.h.piece_priorities(), [1]) + self.h.connect_peer(('127.0.0.1', 6881)) + self.h.connect_peer(('127.0.0.2', 6881), source=4) + self.h.connect_peer(('127.0.0.3', 6881), flags=2) + self.h.connect_peer(('127.0.0.4', 6881), flags=2, source=4) def test_torrent_handle_in_set(self): self.setup()