diff --git a/I2PControl.cpp b/I2PControl.cpp index 913f823c..be32be41 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -1,11 +1,15 @@ -#include "I2PControl.h" +// There is bug in boost 1.49 with gcc 4.7 coming with Debian Wheezy +#define GCC47_BOOST149 ((BOOST_VERSION == 104900) && (__GNUC__ != 4) && (__GNUC_MINOR__ != 7)) +#include "I2PControl.h" #include #include #include #include #include +#if !GCC47_BOOST149 #include +#endif #include "Log.h" #include "NetDb.h" #include "RouterContext.h" @@ -111,7 +115,12 @@ namespace client void I2PControlService::ReadRequest (std::shared_ptr socket) { auto request = std::make_shared(); - socket->async_read_some (boost::asio::buffer (*request), + socket->async_read_some ( +#if BOOST_VERSION >= 104900 + boost::asio::buffer (*request), +#else + boost::asio::buffer (request->data (), request->size ()), +#endif std::bind(&I2PControlService::HandleRequestReceived, this, std::placeholders::_1, std::placeholders::_2, socket, request)); } @@ -142,8 +151,12 @@ namespace client return; // TODO: } } +#if GCC47_BOOST149 + LogPrint (eLogError, "json_read is not supported due bug in boost 1.49 with gcc 4.7"); +#else boost::property_tree::ptree pt; boost::property_tree::read_json (ss, pt); + std::string method = pt.get(I2P_CONTROL_PROPERTY_METHOD); auto it = m_MethodHandlers.find (method); if (it != m_MethodHandlers.end ()) @@ -161,6 +174,7 @@ namespace client } else LogPrint (eLogWarning, "Unknown I2PControl method ", method); +#endif } catch (std::exception& ex) { @@ -187,7 +201,11 @@ namespace client pt.put ("jsonrpc", "2.0"); std::ostringstream ss; +#if GCC47_BOOST149 + LogPrint (eLogError, "json_write is not supported due bug in boost 1.49 with gcc 4.7"); +#else boost::property_tree::write_json (ss, pt, false); +#endif size_t len = ss.str ().length (), offset = 0; if (isHtml) {