"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/remote/jsonrpc.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

jsonrpc.cpp  (icinga2-2.11.5):jsonrpc.cpp  (icinga2-2.12.0)
skipping to change at line 55 skipping to change at line 55
} }
#endif /* I2_DEBUG */ #endif /* I2_DEBUG */
/** /**
* Sends a message to the connected peer and returns the bytes sent. * Sends a message to the connected peer and returns the bytes sent.
* *
* @param message The message. * @param message The message.
* *
* @return The amount of bytes sent. * @return The amount of bytes sent.
*/ */
size_t JsonRpc::SendMessage(const std::shared_ptr<AsioTlsStream>& stream, const Dictionary::Ptr& message) size_t JsonRpc::SendMessage(const Shared<AsioTlsStream>::Ptr& stream, const Dict ionary::Ptr& message)
{ {
String json = JsonEncode(message); String json = JsonEncode(message);
#ifdef I2_DEBUG #ifdef I2_DEBUG
if (GetDebugJsonRpcCached()) if (GetDebugJsonRpcCached())
std::cerr << ConsoleColorTag(Console_ForegroundBlue) << ">> " << json << ConsoleColorTag(Console_Normal) << "\n"; std::cerr << ConsoleColorTag(Console_ForegroundBlue) << ">> " << json << ConsoleColorTag(Console_Normal) << "\n";
#endif /* I2_DEBUG */ #endif /* I2_DEBUG */
return NetString::WriteStringToStream(stream, json); return NetString::WriteStringToStream(stream, json);
} }
/** /**
* Sends a message to the connected peer and returns the bytes sent. * Sends a message to the connected peer and returns the bytes sent.
* *
* @param message The message. * @param message The message.
* *
* @return The amount of bytes sent. * @return The amount of bytes sent.
*/ */
size_t JsonRpc::SendMessage(const std::shared_ptr<AsioTlsStream>& stream, const Dictionary::Ptr& message, boost::asio::yield_context yc) size_t JsonRpc::SendMessage(const Shared<AsioTlsStream>::Ptr& stream, const Dict ionary::Ptr& message, boost::asio::yield_context yc)
{ {
return JsonRpc::SendRawMessage(stream, JsonEncode(message), yc); return JsonRpc::SendRawMessage(stream, JsonEncode(message), yc);
} }
/** /**
* Sends a raw message to the connected peer. * Sends a raw message to the connected peer.
* *
* @param stream ASIO TLS Stream * @param stream ASIO TLS Stream
* @param json message * @param json message
* @param yc Yield context required for ASIO * @param yc Yield context required for ASIO
* *
* @return bytes sent * @return bytes sent
*/ */
size_t JsonRpc::SendRawMessage(const std::shared_ptr<AsioTlsStream>& stream, con st String& json, boost::asio::yield_context yc) size_t JsonRpc::SendRawMessage(const Shared<AsioTlsStream>::Ptr& stream, const S tring& json, boost::asio::yield_context yc)
{ {
#ifdef I2_DEBUG #ifdef I2_DEBUG
if (GetDebugJsonRpcCached()) if (GetDebugJsonRpcCached())
std::cerr << ConsoleColorTag(Console_ForegroundBlue) << ">> " << json << ConsoleColorTag(Console_Normal) << "\n"; std::cerr << ConsoleColorTag(Console_ForegroundBlue) << ">> " << json << ConsoleColorTag(Console_Normal) << "\n";
#endif /* I2_DEBUG */ #endif /* I2_DEBUG */
return NetString::WriteStringToStream(stream, json, yc); return NetString::WriteStringToStream(stream, json, yc);
} }
/** /**
* Reads a message from the connected peer. * Reads a message from the connected peer.
* *
* @param stream ASIO TLS Stream * @param stream ASIO TLS Stream
* @param maxMessageLength maximum size of bytes read. * @param maxMessageLength maximum size of bytes read.
* *
* @return A JSON string * @return A JSON string
*/ */
String JsonRpc::ReadMessage(const std::shared_ptr<AsioTlsStream>& stream, ssize_ t maxMessageLength) String JsonRpc::ReadMessage(const Shared<AsioTlsStream>::Ptr& stream, ssize_t ma xMessageLength)
{ {
String jsonString = NetString::ReadStringFromStream(stream, maxMessageLen gth); String jsonString = NetString::ReadStringFromStream(stream, maxMessageLen gth);
#ifdef I2_DEBUG #ifdef I2_DEBUG
if (GetDebugJsonRpcCached()) if (GetDebugJsonRpcCached())
std::cerr << ConsoleColorTag(Console_ForegroundBlue) << "<< " << jsonString << ConsoleColorTag(Console_Normal) << "\n"; std::cerr << ConsoleColorTag(Console_ForegroundBlue) << "<< " << jsonString << ConsoleColorTag(Console_Normal) << "\n";
#endif /* I2_DEBUG */ #endif /* I2_DEBUG */
return std::move(jsonString); return std::move(jsonString);
} }
/** /**
* Reads a message from the connected peer. * Reads a message from the connected peer.
* *
* @param stream ASIO TLS Stream * @param stream ASIO TLS Stream
* @param yc Yield Context for ASIO * @param yc Yield Context for ASIO
* @param maxMessageLength maximum size of bytes read. * @param maxMessageLength maximum size of bytes read.
* *
* @return A JSON string * @return A JSON string
*/ */
String JsonRpc::ReadMessage(const std::shared_ptr<AsioTlsStream>& stream, boost: :asio::yield_context yc, ssize_t maxMessageLength) String JsonRpc::ReadMessage(const Shared<AsioTlsStream>::Ptr& stream, boost::asi o::yield_context yc, ssize_t maxMessageLength)
{ {
String jsonString = NetString::ReadStringFromStream(stream, yc, maxMessag eLength); String jsonString = NetString::ReadStringFromStream(stream, yc, maxMessag eLength);
#ifdef I2_DEBUG #ifdef I2_DEBUG
if (GetDebugJsonRpcCached()) if (GetDebugJsonRpcCached())
std::cerr << ConsoleColorTag(Console_ForegroundBlue) << "<< " << jsonString << ConsoleColorTag(Console_Normal) << "\n"; std::cerr << ConsoleColorTag(Console_ForegroundBlue) << "<< " << jsonString << ConsoleColorTag(Console_Normal) << "\n";
#endif /* I2_DEBUG */ #endif /* I2_DEBUG */
return std::move(jsonString); return std::move(jsonString);
} }
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)