merged python binding fixes from RC_o_16

This commit is contained in:
Arvid Norberg 2014-02-01 04:02:58 +00:00
parent c02159f143
commit 1f8a32e3bc
2 changed files with 29 additions and 0 deletions

View File

@ -40,6 +40,7 @@
* fix uTP edge case where udp socket buffer fills up
* fix nagle implementation in uTP
* improve error_code and error_category support in python bindings
* fix python binding for external_ip_alert
0.16.14 release

View File

@ -32,17 +32,45 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/python.hpp>
#include <libtorrent/error_code.hpp>
#include <libtorrent/lazy_entry.hpp>
using namespace boost::python;
using namespace libtorrent;
using boost::system::error_category;
void bind_error_code()
{
class_<boost::system::error_category, boost::noncopyable>("error_category", no_init)
.def("name", &error_category::name)
.def("message", &error_category::message)
.def(self == self)
.def(self < self)
.def(self != self)
;
class_<error_code>("error_code")
.def(init<>())
.def("message", &error_code::message)
.def("value", &error_code::value)
.def("clear", &error_code::clear)
.def("category", &error_code::category
, return_internal_reference<>())
.def("assign", &error_code::assign)
;
def("get_libtorrent_category", &get_libtorrent_category
, return_internal_reference<>());
def("get_http_category", &get_http_category
, return_internal_reference<>());
def("get_bdecode_category", &get_bdecode_category
, return_internal_reference<>());
def("generic_category", &boost::system::generic_category
, return_internal_reference<>());
def("system_category", &boost::system::system_category
, return_internal_reference<>());
}