Skip to content

Commit

Permalink
make peer_info::client a byte array in python binding
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jul 2, 2019
1 parent 9da041a commit 462a288
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* make peer_info::client a byte array in python binding
* pick contiguous pieces from peers with high download rate
* fix error handling of moving storage to a drive letter that isn't mounted
* fix HTTP Host header when using proxy
Expand Down
8 changes: 7 additions & 1 deletion bindings/python/src/peer_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include "boost_python.hpp"
#include "bytes.hpp"
#include <libtorrent/peer_info.hpp>
#include <libtorrent/bitfield.hpp>
#include <boost/python/iterator.hpp>
Expand Down Expand Up @@ -47,6 +48,11 @@ list get_pieces(peer_info const& pi)
return ret;
}

bytes get_peer_info_client(peer_info const& pi)
{
return pi.client;
}

using by_value = return_value_policy<return_by_value>;
void bind_peer_info()
{
Expand Down Expand Up @@ -87,7 +93,7 @@ void bind_peer_info()
.add_property("downloading_block_index", make_getter(&peer_info::downloading_block_index, by_value()))
.def_readonly("downloading_progress", &peer_info::downloading_progress)
.def_readonly("downloading_total", &peer_info::downloading_total)
.def_readonly("client", &peer_info::client)
.add_property("client", get_peer_info_client)
.def_readonly("connection_type", &peer_info::connection_type)
.def_readonly("pending_disk_bytes", &peer_info::pending_disk_bytes)
.def_readonly("send_quota", &peer_info::send_quota)
Expand Down

0 comments on commit 462a288

Please sign in to comment.