forked from premiere/premiere-libtorrent
fix master python binding
This commit is contained in:
parent
69dc73914a
commit
15d11d29e7
|
@ -880,7 +880,16 @@ void bind_session()
|
|||
.value("upnp", lt::portmap_transport::upnp)
|
||||
;
|
||||
|
||||
class_<lt::peer_class_type_filter>("peer_class_type_filter")
|
||||
enum_<lt::peer_class_type_filter::socket_type_t>("peer_class_type_filter_socket_type_t")
|
||||
.value("tcp_socket", peer_class_type_filter::tcp_socket)
|
||||
.value("utp_socket", peer_class_type_filter::utp_socket)
|
||||
.value("ssl_tcp_socket", peer_class_type_filter::ssl_tcp_socket)
|
||||
.value("ssl_utp_socket", peer_class_type_filter::ssl_utp_socket)
|
||||
.value("i2p_socket", peer_class_type_filter::i2p_socket)
|
||||
;
|
||||
|
||||
{
|
||||
scope s = class_<lt::peer_class_type_filter>("peer_class_type_filter")
|
||||
.def(init<>())
|
||||
.def("add", <::peer_class_type_filter::add)
|
||||
.def("remove", <::peer_class_type_filter::remove)
|
||||
|
@ -888,14 +897,12 @@ void bind_session()
|
|||
.def("allow", <::peer_class_type_filter::allow)
|
||||
.def("apply", <::peer_class_type_filter::apply)
|
||||
;
|
||||
|
||||
enum_<lt::peer_class_type_filter::socket_type_t>("socket_type_t")
|
||||
.value("tcp_socket", peer_class_type_filter::tcp_socket)
|
||||
.value("utp_socket", peer_class_type_filter::utp_socket)
|
||||
.value("ssl_tcp_socket", peer_class_type_filter::ssl_tcp_socket)
|
||||
.value("ssl_utp_socket", peer_class_type_filter::ssl_utp_socket)
|
||||
.value("i2p_socket", peer_class_type_filter::i2p_socket)
|
||||
;
|
||||
s.attr("tcp_socket") = peer_class_type_filter::tcp_socket;
|
||||
s.attr("utp_socket") = peer_class_type_filter::utp_socket;
|
||||
s.attr("ssl_tcp_socket") = peer_class_type_filter::ssl_tcp_socket;
|
||||
s.attr("ssl_utp_socket") = peer_class_type_filter::ssl_utp_socket;
|
||||
s.attr("i2p_socket") = peer_class_type_filter::i2p_socket;
|
||||
}
|
||||
|
||||
{
|
||||
scope s = class_<lt::session, boost::noncopyable>("session", no_init)
|
||||
|
|
|
@ -459,11 +459,11 @@ class test_peer_class(unittest.TestCase):
|
|||
|
||||
def test_peer_class_filter(self):
|
||||
filt = lt.peer_class_type_filter()
|
||||
filt.add(lt.socket_type_t.tcp_socket, lt.session.global_peer_class_id);
|
||||
filt.remove(lt.socket_type_t.utp_socket, lt.session.local_peer_class_id);
|
||||
filt.add(lt.peer_class_type_filter.tcp_socket, lt.session.global_peer_class_id);
|
||||
filt.remove(lt.peer_class_type_filter.utp_socket, lt.session.local_peer_class_id);
|
||||
|
||||
filt.disallow(lt.socket_type_t.tcp_socket, lt.session.global_peer_class_id);
|
||||
filt.allow(lt.socket_type_t.utp_socket, lt.session.local_peer_class_id);
|
||||
filt.disallow(lt.peer_class_type_filter.tcp_socket, lt.session.global_peer_class_id);
|
||||
filt.allow(lt.peer_class_type_filter.utp_socket, lt.session.local_peer_class_id);
|
||||
|
||||
def test_peer_class_ip_filter(self):
|
||||
s = lt.session({'enable_dht': False})
|
||||
|
|
Loading…
Reference in New Issue