fix python build

This commit is contained in:
arvidn 2015-11-29 11:12:58 -05:00
parent 332799bff2
commit 87b64f083a
2 changed files with 21 additions and 2 deletions

View File

@ -5,6 +5,7 @@
#include <boost/python.hpp> #include <boost/python.hpp>
#include <libtorrent/alert.hpp> #include <libtorrent/alert.hpp>
#include <libtorrent/alert_types.hpp> #include <libtorrent/alert_types.hpp>
#include <libtorrent/piece_picker.hpp> // for piece_block
#include <memory> #include <memory>
using namespace boost::python; using namespace boost::python;
@ -422,6 +423,8 @@ void bind_alert()
.def_readonly("map_type", &portmap_alert::map_type) .def_readonly("map_type", &portmap_alert::map_type)
; ;
#ifndef TORRENT_DISABLE_LOGGING
class_<portmap_log_alert, bases<alert>, noncopyable>( class_<portmap_log_alert, bases<alert>, noncopyable>(
"portmap_log_alert", no_init) "portmap_log_alert", no_init)
.def_readonly("map_type", &portmap_log_alert::map_type) .def_readonly("map_type", &portmap_log_alert::map_type)
@ -431,6 +434,8 @@ void bind_alert()
#endif #endif
; ;
#endif // TORRENT_DISABLE_LOGGING
class_<fastresume_rejected_alert, bases<torrent_alert>, noncopyable>( class_<fastresume_rejected_alert, bases<torrent_alert>, noncopyable>(
"fastresume_rejected_alert", no_init) "fastresume_rejected_alert", no_init)
.def_readonly("error", &fastresume_rejected_alert::error) .def_readonly("error", &fastresume_rejected_alert::error)
@ -665,6 +670,8 @@ void bind_alert()
.add_property("ip", &dht_outgoing_get_peers_alert_ip) .add_property("ip", &dht_outgoing_get_peers_alert_ip)
; ;
#ifndef TORRENT_DISABLE_LOGGING
class_<log_alert, bases<alert>, noncopyable>( class_<log_alert, bases<alert>, noncopyable>(
"log_alert", no_init) "log_alert", no_init)
.def("msg", &log_alert::msg) .def("msg", &log_alert::msg)
@ -680,6 +687,14 @@ void bind_alert()
.def("msg", &peer_log_alert::msg) .def("msg", &peer_log_alert::msg)
; ;
class_<picker_log_alert, bases<peer_alert>, noncopyable>(
"picker_log_alert", no_init)
.add_property("picker_flags", &picker_log_alert::picker_flags)
.def("blocks", &picker_log_alert::blocks)
;
#endif // TORRENT_DISABLE_LOGGING
class_<lsd_error_alert, bases<alert>, noncopyable>( class_<lsd_error_alert, bases<alert>, noncopyable>(
"lsd_error_alert", no_init) "lsd_error_alert", no_init)
.def_readonly("error", &lsd_error_alert::error) .def_readonly("error", &lsd_error_alert::error)

View File

@ -5311,6 +5311,7 @@ retry:
m_alerts.emplace_alert<lsd_peer_alert>(t->get_handle(), peer); m_alerts.emplace_alert<lsd_peer_alert>(t->get_handle(), peer);
} }
// TODO: perhaps this function should not exist when logging is disabled
void session_impl::on_port_map_log( void session_impl::on_port_map_log(
char const* msg, int map_transport) char const* msg, int map_transport)
{ {
@ -5319,6 +5320,9 @@ retry:
// log message // log message
if (m_alerts.should_post<portmap_log_alert>()) if (m_alerts.should_post<portmap_log_alert>())
m_alerts.emplace_alert<portmap_log_alert>(map_transport, msg); m_alerts.emplace_alert<portmap_log_alert>(map_transport, msg);
#else
TORRENT_UNUSED(msg);
TORRENT_UNUSED(map_transport);
#endif #endif
} }