mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 23:45:51 +00:00
Tidy up ripple modules for namespace support
This commit is contained in:
@@ -4,5 +4,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#if RIPPLE_USE_NAMESPACE
|
||||
ripple::LogPartition AutoSocket::AutoSocketPartition ("AutoSocket");
|
||||
#else
|
||||
LogPartition AutoSocket::AutoSocketPartition ("AutoSocket");
|
||||
|
||||
#endif
|
||||
|
||||
@@ -73,6 +73,10 @@ public:
|
||||
|
||||
static bool rfc2818_verify (const std::string& domain, bool preverified, boost::asio::ssl::verify_context& ctx)
|
||||
{
|
||||
#if RIPPLE_USE_NAMESPACE
|
||||
using namespace ripple;
|
||||
#endif
|
||||
|
||||
if (boost::asio::ssl::rfc2818_verification (domain) (preverified, ctx))
|
||||
return true;
|
||||
|
||||
@@ -224,6 +228,10 @@ public:
|
||||
protected:
|
||||
void handle_autodetect (callback cbFunc, const error_code& ec, size_t bytesTransferred)
|
||||
{
|
||||
#if RIPPLE_USE_NAMESPACE
|
||||
using namespace ripple;
|
||||
#endif
|
||||
|
||||
if (ec)
|
||||
{
|
||||
Log (lsWARNING, AutoSocketPartition) << "Handle autodetect error: " << ec;
|
||||
@@ -253,8 +261,11 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
#if RIPPLE_USE_NAMESPACE
|
||||
static ripple::LogPartition AutoSocketPartition;
|
||||
#else
|
||||
static LogPartition AutoSocketPartition;
|
||||
|
||||
#endif
|
||||
socket_ptr mSocket;
|
||||
bool mSecure;
|
||||
|
||||
|
||||
86
modules/ripple_websocket/autosocket/ripple_LogWebsockets.cpp
Normal file
86
modules/ripple_websocket/autosocket/ripple_LogWebsockets.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
// VFALCO NOTE this looks like some facility for giving websocket
|
||||
// a way to produce logging output.
|
||||
//
|
||||
namespace websocketpp
|
||||
{
|
||||
namespace log
|
||||
{
|
||||
|
||||
#if RIPPLE_USE_NAMESPACE
|
||||
using namespace ripple;
|
||||
|
||||
LogPartition websocketPartition ("WebSocket");
|
||||
|
||||
void websocketLog (websocketpp::log::alevel::value v, const std::string& entry)
|
||||
{
|
||||
using namespace ripple;
|
||||
|
||||
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
|
||||
{
|
||||
if (websocketPartition.doLog (lsTRACE))
|
||||
Log (lsDEBUG, websocketPartition) << entry;
|
||||
}
|
||||
else if (websocketPartition.doLog (lsDEBUG))
|
||||
Log (lsDEBUG, websocketPartition) << entry;
|
||||
}
|
||||
|
||||
void websocketLog (websocketpp::log::elevel::value v, const std::string& entry)
|
||||
{
|
||||
using namespace ripple;
|
||||
|
||||
LogSeverity s = lsDEBUG;
|
||||
|
||||
if ((v & websocketpp::log::elevel::INFO) != 0)
|
||||
s = lsINFO;
|
||||
else if ((v & websocketpp::log::elevel::FATAL) != 0)
|
||||
s = lsFATAL;
|
||||
else if ((v & websocketpp::log::elevel::RERROR) != 0)
|
||||
s = lsERROR;
|
||||
else if ((v & websocketpp::log::elevel::WARN) != 0)
|
||||
s = lsWARNING;
|
||||
|
||||
if (websocketPartition.doLog (s))
|
||||
Log (s, websocketPartition) << entry;
|
||||
}
|
||||
#else
|
||||
LogPartition websocketPartition ("WebSocket");
|
||||
|
||||
void websocketLog (websocketpp::log::alevel::value v, const std::string& entry)
|
||||
{
|
||||
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
|
||||
{
|
||||
if (websocketPartition.doLog (lsTRACE))
|
||||
Log (lsDEBUG, websocketPartition) << entry;
|
||||
}
|
||||
else if (websocketPartition.doLog (lsDEBUG))
|
||||
Log (lsDEBUG, websocketPartition) << entry;
|
||||
}
|
||||
|
||||
void websocketLog (websocketpp::log::elevel::value v, const std::string& entry)
|
||||
{
|
||||
LogSeverity s = lsDEBUG;
|
||||
|
||||
if ((v & websocketpp::log::elevel::INFO) != 0)
|
||||
s = lsINFO;
|
||||
else if ((v & websocketpp::log::elevel::FATAL) != 0)
|
||||
s = lsFATAL;
|
||||
else if ((v & websocketpp::log::elevel::RERROR) != 0)
|
||||
s = lsERROR;
|
||||
else if ((v & websocketpp::log::elevel::WARN) != 0)
|
||||
s = lsWARNING;
|
||||
|
||||
if (websocketPartition.doLog (s))
|
||||
Log (s, websocketPartition) << entry;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
@@ -24,3 +24,4 @@
|
||||
#include "websocket/src/sha1/sha1.cpp"
|
||||
|
||||
#include "autosocket/ripple_AutoSocket.cpp"
|
||||
#include "autosocket/ripple_LogWebsockets.cpp"
|
||||
|
||||
@@ -21,13 +21,6 @@
|
||||
@deprecated
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO NOTE Log dependencies have wormed their way into websocketpp,
|
||||
// which needs the ripple_basic module to compile.
|
||||
@@ -37,6 +30,14 @@
|
||||
//
|
||||
#include "../modules/ripple_basics/ripple_basics.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// VFALCO TODO This include is just to prevent a warning about
|
||||
// redefinition of __STDC_LIMIT_MACROS. Fix it right.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user