Add ripple_net module

This commit is contained in:
Vinnie Falco
2013-05-22 17:02:40 -07:00
parent a5360379ac
commit f4cb47fed6
12 changed files with 416 additions and 301 deletions

View File

@@ -0,0 +1,52 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
/** Add this to get the @ref ripple_net module.
@file ripple_net.cpp
@ingroup ripple_net
*/
#include "ripple_net.h"
// VFALCO: TODO, fix these warnings!
#ifdef _MSC_VER
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
//#pragma warning (disable: 4018) // signed/unsigned mismatch
//#pragma warning (disable: 4244) // conversion, possible loss of data
#endif
#include "src/cpp/ripple/Application.h"
// This is for PeerDoor and WSDoor
// Generate DH for SSL connection.
static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
{
// VFALCO: TODO, eliminate this horrendous dependency on theApp and Wallet
return 512 == iKeyLength ? theApp->getWallet().getDh512() : theApp->getWallet().getDh1024();
}
#include "src/cpp/ripple/ConnectionPool.cpp"
#include "src/cpp/ripple/NetworkOPs.cpp"
#include "src/cpp/ripple/Peer.cpp"
#include "src/cpp/ripple/PeerDoor.cpp"
#include "src/cpp/ripple/WSDoor.cpp" // uses logging in WSConnection.h
#ifdef _MSC_VER
//#pragma warning (pop)
#endif

View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
/** Include this to get the @ref ripple_net module.
@file ripple_net.h
@ingroup ripple_net
*/
/** Peer to peer overlay classes.
Contains classes that support the peer to peer overlay.
@defgroup ripple_net
*/
#ifndef RIPPLE_NET_H
#define RIPPLE_NET_H
#endif

View File

@@ -172,6 +172,7 @@
<ClCompile Include="modules\ripple_db\ripple_db.cpp" /> <ClCompile Include="modules\ripple_db\ripple_db.cpp" />
<ClCompile Include="modules\ripple_ledger\ripple_ledger.cpp" /> <ClCompile Include="modules\ripple_ledger\ripple_ledger.cpp" />
<ClCompile Include="modules\ripple_main\ripple_main.cpp" /> <ClCompile Include="modules\ripple_main\ripple_main.cpp" />
<ClCompile Include="modules\ripple_net\ripple_net.cpp" />
<ClCompile Include="src\cpp\database\database.cpp"> <ClCompile Include="src\cpp\database\database.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -595,7 +596,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\ConnectionPool.cpp" /> <ClCompile Include="src\cpp\ripple\ConnectionPool.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\ripple\Contract.cpp"> <ClCompile Include="src\cpp\ripple\Contract.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -739,7 +745,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\NetworkOPs.cpp" /> <ClCompile Include="src\cpp\ripple\NetworkOPs.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\ripple\NicknameState.cpp" /> <ClCompile Include="src\cpp\ripple\NicknameState.cpp" />
<ClCompile Include="src\cpp\ripple\Offer.cpp"> <ClCompile Include="src\cpp\ripple\Offer.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@@ -803,8 +814,18 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\Peer.cpp" /> <ClCompile Include="src\cpp\ripple\Peer.cpp">
<ClCompile Include="src\cpp\ripple\PeerDoor.cpp" /> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\ripple\PeerDoor.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\ripple\PFRequest.cpp" /> <ClCompile Include="src\cpp\ripple\PFRequest.cpp" />
<ClCompile Include="src\cpp\ripple\PlatRand.cpp"> <ClCompile Include="src\cpp\ripple\PlatRand.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
@@ -1031,7 +1052,12 @@
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\Wallet.cpp" /> <ClCompile Include="src\cpp\ripple\Wallet.cpp" />
<ClCompile Include="src\cpp\ripple\WalletAddTransactor.cpp" /> <ClCompile Include="src\cpp\ripple\WalletAddTransactor.cpp" />
<ClCompile Include="src\cpp\ripple\WSDoor.cpp" /> <ClCompile Include="src\cpp\ripple\WSDoor.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\cpp\websocketpp\src\base64\base64.cpp"> <ClCompile Include="src\cpp\websocketpp\src\base64\base64.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
@@ -1078,6 +1104,7 @@
<ClInclude Include="modules\ripple_db\ripple_db.h" /> <ClInclude Include="modules\ripple_db\ripple_db.h" />
<ClInclude Include="modules\ripple_ledger\ripple_ledger.h" /> <ClInclude Include="modules\ripple_ledger\ripple_ledger.h" />
<ClInclude Include="modules\ripple_main\ripple_main.h" /> <ClInclude Include="modules\ripple_main\ripple_main.h" />
<ClInclude Include="modules\ripple_net\ripple_net.h" />
<ClInclude Include="src\cpp\database\database.h" /> <ClInclude Include="src\cpp\database\database.h" />
<ClInclude Include="src\cpp\database\SqliteDatabase.h" /> <ClInclude Include="src\cpp\database\SqliteDatabase.h" />
<ClInclude Include="src\cpp\json\autolink.h"> <ClInclude Include="src\cpp\json\autolink.h">

View File

@@ -107,6 +107,9 @@
<Filter Include="1. Modules\ripple_client\http"> <Filter Include="1. Modules\ripple_client\http">
<UniqueIdentifier>{29cd2103-d553-4d82-9e6a-224e3b1cb667}</UniqueIdentifier> <UniqueIdentifier>{29cd2103-d553-4d82-9e6a-224e3b1cb667}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="1. Modules\ripple_net\sockets">
<UniqueIdentifier>{afd09812-59e2-45e2-bf7f-d561b23d7da2}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\cpp\database\sqlite3.c"> <ClCompile Include="src\cpp\database\sqlite3.c">
@@ -436,15 +439,6 @@
<ClCompile Include="src\cpp\ripple\ripple.pb.cc"> <ClCompile Include="src\cpp\ripple\ripple.pb.cc">
<Filter>protoc_generated</Filter> <Filter>protoc_generated</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\ConnectionPool.cpp">
<Filter>1. Modules\ripple_net</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\Peer.cpp">
<Filter>1. Modules\ripple_net</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\PeerDoor.cpp">
<Filter>1. Modules\ripple_net</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\Transaction.cpp"> <ClCompile Include="src\cpp\ripple\Transaction.cpp">
<Filter>1. Modules\ripple_ledger\transactions</Filter> <Filter>1. Modules\ripple_ledger\transactions</Filter>
</ClCompile> </ClCompile>
@@ -499,9 +493,6 @@
<ClCompile Include="src\cpp\ripple\Contract.cpp"> <ClCompile Include="src\cpp\ripple\Contract.cpp">
<Filter>1. Modules\ripple_ledger\contracts</Filter> <Filter>1. Modules\ripple_ledger\contracts</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\NetworkOPs.cpp">
<Filter>1. Modules\ripple_net</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\SerializedLedger.cpp"> <ClCompile Include="src\cpp\ripple\SerializedLedger.cpp">
<Filter>1. Modules\ripple_ledger\serialization</Filter> <Filter>1. Modules\ripple_ledger\serialization</Filter>
</ClCompile> </ClCompile>
@@ -520,9 +511,6 @@
<ClCompile Include="src\cpp\ripple\Serializer.cpp"> <ClCompile Include="src\cpp\ripple\Serializer.cpp">
<Filter>1. Modules\ripple_ledger\serialization</Filter> <Filter>1. Modules\ripple_ledger\serialization</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
<Filter>1. Modules\ripple_net</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\Amount.cpp"> <ClCompile Include="src\cpp\ripple\Amount.cpp">
<Filter>1. Modules\ripple_basics\types</Filter> <Filter>1. Modules\ripple_basics\types</Filter>
</ClCompile> </ClCompile>
@@ -718,6 +706,24 @@
<ClCompile Include="src\cpp\ripple\HTTPRequest.cpp"> <ClCompile Include="src\cpp\ripple\HTTPRequest.cpp">
<Filter>1. Modules\ripple_client\http</Filter> <Filter>1. Modules\ripple_client\http</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\cpp\ripple\ConnectionPool.cpp">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\NetworkOPs.cpp">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\Peer.cpp">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\PeerDoor.cpp">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClCompile>
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClCompile>
<ClCompile Include="modules\ripple_net\ripple_net.cpp">
<Filter>1. Modules\ripple_net</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="database\sqlite3ext.h"> <ClInclude Include="database\sqlite3ext.h">
@@ -1074,18 +1080,6 @@
<ClInclude Include="src\cpp\ripple\ripple.pb.h"> <ClInclude Include="src\cpp\ripple\ripple.pb.h">
<Filter>protoc_generated</Filter> <Filter>protoc_generated</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\cpp\ripple\AutoSocket.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\ConnectionPool.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\PeerDoor.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\Peer.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\Transaction.h"> <ClInclude Include="src\cpp\ripple\Transaction.h">
<Filter>1. Modules\ripple_ledger\transactions</Filter> <Filter>1. Modules\ripple_ledger\transactions</Filter>
</ClInclude> </ClInclude>
@@ -1134,9 +1128,6 @@
<ClInclude Include="src\cpp\ripple\Contract.h"> <ClInclude Include="src\cpp\ripple\Contract.h">
<Filter>1. Modules\ripple_ledger\contracts</Filter> <Filter>1. Modules\ripple_ledger\contracts</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\cpp\ripple\NetworkOPs.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\SerializedLedger.h"> <ClInclude Include="src\cpp\ripple\SerializedLedger.h">
<Filter>1. Modules\ripple_ledger\serialization</Filter> <Filter>1. Modules\ripple_ledger\serialization</Filter>
</ClInclude> </ClInclude>
@@ -1158,12 +1149,6 @@
<ClInclude Include="src\cpp\ripple\Serializer.h"> <ClInclude Include="src\cpp\ripple\Serializer.h">
<Filter>1. Modules\ripple_ledger\serialization</Filter> <Filter>1. Modules\ripple_ledger\serialization</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\cpp\ripple\WSDoor.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\WSConnection.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\base58.h"> <ClInclude Include="src\cpp\ripple\base58.h">
<Filter>1. Modules\ripple_basics\types</Filter> <Filter>1. Modules\ripple_basics\types</Filter>
</ClInclude> </ClInclude>
@@ -1356,6 +1341,30 @@
<ClInclude Include="src\cpp\ripple\HTTPRequest.h"> <ClInclude Include="src\cpp\ripple\HTTPRequest.h">
<Filter>1. Modules\ripple_client\http</Filter> <Filter>1. Modules\ripple_client\http</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\cpp\ripple\WSDoor.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\AutoSocket.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\ConnectionPool.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\NetworkOPs.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\Peer.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\PeerDoor.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="src\cpp\ripple\WSConnection.h">
<Filter>1. Modules\ripple_net\sockets</Filter>
</ClInclude>
<ClInclude Include="modules\ripple_net\ripple_net.h">
<Filter>1. Modules\ripple_net</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="wallet.xml" /> <None Include="wallet.xml" />

View File

@@ -15,8 +15,6 @@
#include "utils.h" #include "utils.h"
#include "Log.h" #include "Log.h"
SETUP_LOG();
// How often to enforce policies. // How often to enforce policies.
#define POLICY_INTERVAL_SECONDS 5 #define POLICY_INTERVAL_SECONDS 5
@@ -169,7 +167,7 @@ void ConnectionPool::policyLowWater()
if (getPeerCount() > theConfig.PEER_CONNECT_LOW_WATER) if (getPeerCount() > theConfig.PEER_CONNECT_LOW_WATER)
{ {
// Above low water mark, don't need more connections. // Above low water mark, don't need more connections.
cLog(lsTRACE) << "Pool: Low water: sufficient connections: " << mConnectedMap.size() << "/" << theConfig.PEER_CONNECT_LOW_WATER; WriteLog (lsTRACE, ConnectionPool) << "Pool: Low water: sufficient connections: " << mConnectedMap.size() << "/" << theConfig.PEER_CONNECT_LOW_WATER;
nothing(); nothing();
} }
@@ -183,7 +181,7 @@ void ConnectionPool::policyLowWater()
else if (!peerAvailable(strIp, iPort)) else if (!peerAvailable(strIp, iPort))
{ {
// No more connections available to start. // No more connections available to start.
cLog(lsTRACE) << "Pool: Low water: no peers available."; WriteLog (lsTRACE, ConnectionPool) << "Pool: Low water: no peers available.";
// XXX Might ask peers for more ips. // XXX Might ask peers for more ips.
nothing(); nothing();
@@ -191,11 +189,11 @@ void ConnectionPool::policyLowWater()
else else
{ {
// Try to start connection. // Try to start connection.
cLog(lsTRACE) << "Pool: Low water: start connection."; WriteLog (lsTRACE, ConnectionPool) << "Pool: Low water: start connection.";
if (!peerConnect(strIp, iPort)) if (!peerConnect(strIp, iPort))
{ {
cLog(lsINFO) << "Pool: Low water: already connected."; WriteLog (lsINFO, ConnectionPool) << "Pool: Low water: already connected.";
} }
// Check if we need more. // Check if we need more.
@@ -213,7 +211,7 @@ void ConnectionPool::policyEnforce()
if (((++mPhase) % 12) == 0) if (((++mPhase) % 12) == 0)
{ {
cLog(lsTRACE) << "Making configured connections"; WriteLog (lsTRACE, ConnectionPool) << "Making configured connections";
makeConfigured(); makeConfigured();
} }
@@ -321,11 +319,11 @@ Peer::pointer ConnectionPool::peerConnect(const std::string& strIp, int iPort)
if (ppResult) if (ppResult)
{ {
ppResult->connect(strIp, iPort); ppResult->connect(strIp, iPort);
cLog(lsDEBUG) << "Pool: Connecting: " << strIp << " " << iPort; WriteLog (lsDEBUG, ConnectionPool) << "Pool: Connecting: " << strIp << " " << iPort;
} }
else else
{ {
cLog(lsTRACE) << "Pool: Already connected: " << strIp << " " << iPort; WriteLog (lsTRACE, ConnectionPool) << "Pool: Already connected: " << strIp << " " << iPort;
} }
return ppResult; return ppResult;
@@ -386,7 +384,7 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const RippleAddress& naPeer,
if (naPeer == theApp->getWallet().getNodePublic()) if (naPeer == theApp->getWallet().getNodePublic())
{ {
cLog(lsINFO) << "Pool: Connected: self: " << ADDRESS_SHARED(peer) << ": " << naPeer.humanNodePublic() << " " << strIP << " " << iPort; WriteLog (lsINFO, ConnectionPool) << "Pool: Connected: self: " << ADDRESS_SHARED(peer) << ": " << naPeer.humanNodePublic() << " " << strIP << " " << iPort;
} }
else else
{ {
@@ -396,7 +394,7 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const RippleAddress& naPeer,
if (itCm == mConnectedMap.end()) if (itCm == mConnectedMap.end())
{ {
// New connection. // New connection.
//cLog(lsINFO) << "Pool: Connected: new: " << ADDRESS_SHARED(peer) << ": " << naPeer.humanNodePublic() << " " << strIP << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Connected: new: " << ADDRESS_SHARED(peer) << ": " << naPeer.humanNodePublic() << " " << strIP << " " << iPort;
mConnectedMap[naPeer] = peer; mConnectedMap[naPeer] = peer;
bNew = true; bNew = true;
@@ -412,7 +410,7 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const RippleAddress& naPeer,
if (itCm->second->getIP().empty()) if (itCm->second->getIP().empty())
{ {
// Old peer did not know it's IP. // Old peer did not know it's IP.
//cLog(lsINFO) << "Pool: Connected: redundant: outbound: " << ADDRESS_SHARED(peer) << " discovered: " << ADDRESS_SHARED(itCm->second) << ": " << strIP << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Connected: redundant: outbound: " << ADDRESS_SHARED(peer) << " discovered: " << ADDRESS_SHARED(itCm->second) << ": " << strIP << " " << iPort;
itCm->second->setIpPort(strIP, iPort); itCm->second->setIpPort(strIP, iPort);
@@ -422,14 +420,14 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const RippleAddress& naPeer,
else else
{ {
// Old peer knew its IP. Do nothing. // Old peer knew its IP. Do nothing.
//cLog(lsINFO) << "Pool: Connected: redundant: outbound: rediscovered: " << ADDRESS_SHARED(peer) << " " << strIP << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Connected: redundant: outbound: rediscovered: " << ADDRESS_SHARED(peer) << " " << strIP << " " << iPort;
nothing(); nothing();
} }
} }
else else
{ {
//cLog(lsINFO) << "Pool: Connected: redundant: inbound: " << ADDRESS_SHARED(peer) << " " << strIP << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Connected: redundant: inbound: " << ADDRESS_SHARED(peer) << " " << strIP << " " << iPort;
nothing(); nothing();
} }
@@ -450,12 +448,12 @@ void ConnectionPool::peerDisconnected(Peer::ref peer, const RippleAddress& naPee
if (itCm == mConnectedMap.end()) if (itCm == mConnectedMap.end())
{ {
// Did not find it. Not already connecting or connected. // Did not find it. Not already connecting or connected.
cLog(lsWARNING) << "Pool: disconnected: Internal Error: mConnectedMap was inconsistent."; WriteLog (lsWARNING, ConnectionPool) << "Pool: disconnected: Internal Error: mConnectedMap was inconsistent.";
// XXX Maybe bad error, considering we have racing connections, may not so bad. // XXX Maybe bad error, considering we have racing connections, may not so bad.
} }
else if (itCm->second != peer) else if (itCm->second != peer)
{ {
cLog(lsWARNING) << "Pool: disconected: non canonical entry"; WriteLog (lsWARNING, ConnectionPool) << "Pool: disconected: non canonical entry";
nothing(); nothing();
} }
@@ -464,12 +462,12 @@ void ConnectionPool::peerDisconnected(Peer::ref peer, const RippleAddress& naPee
// Found it. Delete it. // Found it. Delete it.
mConnectedMap.erase(itCm); mConnectedMap.erase(itCm);
//cLog(lsINFO) << "Pool: disconnected: " << naPeer.humanNodePublic() << " " << peer->getIP() << " " << peer->getPort(); //WriteLog (lsINFO, ConnectionPool) << "Pool: disconnected: " << naPeer.humanNodePublic() << " " << peer->getIP() << " " << peer->getPort();
} }
} }
else else
{ {
//cLog(lsINFO) << "Pool: disconnected: anonymous: " << peer->getIP() << " " << peer->getPort(); //WriteLog (lsINFO, ConnectionPool) << "Pool: disconnected: anonymous: " << peer->getIP() << " " << peer->getPort();
} }
assert(peer->getPeerId() != 0); assert(peer->getPeerId() != 0);
@@ -498,7 +496,7 @@ bool ConnectionPool::peerScanSet(const std::string& strIp, int iPort)
boost::posix_time::ptime tpNow = boost::posix_time::second_clock::universal_time(); boost::posix_time::ptime tpNow = boost::posix_time::second_clock::universal_time();
boost::posix_time::ptime tpNext = tpNow + boost::posix_time::seconds(iInterval); boost::posix_time::ptime tpNext = tpNow + boost::posix_time::seconds(iInterval);
//cLog(lsINFO) << str(boost::format("Pool: Scan: schedule create: %s %s (next %s, delay=%d)") //WriteLog (lsINFO, ConnectionPool) << str(boost::format("Pool: Scan: schedule create: %s %s (next %s, delay=%d)")
// % mScanIp % mScanPort % tpNext % (tpNext-tpNow).total_seconds()); // % mScanIp % mScanPort % tpNext % (tpNext-tpNow).total_seconds());
db->executeSQL(str(boost::format("UPDATE PeerIps SET ScanNext=%d,ScanInterval=%d WHERE IpPort=%s;") db->executeSQL(str(boost::format("UPDATE PeerIps SET ScanNext=%d,ScanInterval=%d WHERE IpPort=%s;")
@@ -514,14 +512,14 @@ bool ConnectionPool::peerScanSet(const std::string& strIp, int iPort)
// boost::posix_time::ptime tpNow = boost::posix_time::second_clock::universal_time(); // boost::posix_time::ptime tpNow = boost::posix_time::second_clock::universal_time();
// boost::posix_time::ptime tpNext = ptFromSeconds(db->getInt("ScanNext")); // boost::posix_time::ptime tpNext = ptFromSeconds(db->getInt("ScanNext"));
//cLog(lsINFO) << str(boost::format("Pool: Scan: schedule exists: %s %s (next %s, delay=%d)") //WriteLog (lsINFO, ConnectionPool) << str(boost::format("Pool: Scan: schedule exists: %s %s (next %s, delay=%d)")
// % mScanIp % mScanPort % tpNext % (tpNext-tpNow).total_seconds()); // % mScanIp % mScanPort % tpNext % (tpNext-tpNow).total_seconds());
} }
db->endIterRows(); db->endIterRows();
} }
else else
{ {
//cLog(lsWARNING) << "Pool: Scan: peer wasn't in PeerIps: " << strIp << " " << iPort; //WriteLog (lsWARNING, ConnectionPool) << "Pool: Scan: peer wasn't in PeerIps: " << strIp << " " << iPort;
} }
return bScanDirty; return bScanDirty;
@@ -536,7 +534,7 @@ void ConnectionPool::peerClosed(Peer::ref peer, const std::string& strIp, int iP
// If the connection was our scan, we are no longer scanning. // If the connection was our scan, we are no longer scanning.
if (mScanning && mScanning == peer) if (mScanning && mScanning == peer)
{ {
//cLog(lsINFO) << "Pool: Scan: scan fail: " << strIp << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Scan: scan fail: " << strIp << " " << iPort;
mScanning.reset(); // No longer scanning. mScanning.reset(); // No longer scanning.
bScanRefresh = true; // Look for more to scan. bScanRefresh = true; // Look for more to scan.
@@ -551,13 +549,13 @@ void ConnectionPool::peerClosed(Peer::ref peer, const std::string& strIp, int iP
if (itIp == mIpMap.end()) if (itIp == mIpMap.end())
{ {
// Did not find it. Not already connecting or connected. // Did not find it. Not already connecting or connected.
cLog(lsWARNING) << "Pool: Closed: UNEXPECTED: " << ADDRESS_SHARED(peer) << ": " << strIp << " " << iPort; WriteLog (lsWARNING, ConnectionPool) << "Pool: Closed: UNEXPECTED: " << ADDRESS_SHARED(peer) << ": " << strIp << " " << iPort;
// XXX Internal error. // XXX Internal error.
} }
else if (mIpMap[ipPeer] == peer) else if (mIpMap[ipPeer] == peer)
{ {
// We were the identified connection. // We were the identified connection.
//cLog(lsINFO) << "Pool: Closed: identified: " << ADDRESS_SHARED(peer) << ": " << strIp << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Closed: identified: " << ADDRESS_SHARED(peer) << ": " << strIp << " " << iPort;
// Delete our entry. // Delete our entry.
mIpMap.erase(itIp); mIpMap.erase(itIp);
@@ -567,7 +565,7 @@ void ConnectionPool::peerClosed(Peer::ref peer, const std::string& strIp, int iP
else else
{ {
// Found it. But, we were redundant. // Found it. But, we were redundant.
//cLog(lsINFO) << "Pool: Closed: redundant: " << ADDRESS_SHARED(peer) << ": " << strIp << " " << iPort; //WriteLog (lsINFO, ConnectionPool) << "Pool: Closed: redundant: " << ADDRESS_SHARED(peer) << ": " << strIp << " " << iPort;
} }
} }
@@ -591,7 +589,7 @@ void ConnectionPool::peerVerified(Peer::ref peer)
std::string strIpPort = str(boost::format("%s %d") % strIp % iPort); std::string strIpPort = str(boost::format("%s %d") % strIp % iPort);
//cLog(lsINFO) << str(boost::format("Pool: Scan: connected: %s %s %s (scanned)") % ADDRESS_SHARED(peer) % strIp % iPort); //WriteLog (lsINFO, ConnectionPool) << str(boost::format("Pool: Scan: connected: %s %s %s (scanned)") % ADDRESS_SHARED(peer) % strIp % iPort);
if (peer->getNodePublic() == theApp->getWallet().getNodePublic()) if (peer->getNodePublic() == theApp->getWallet().getNodePublic())
{ {
@@ -656,7 +654,7 @@ void ConnectionPool::scanRefresh()
else if (mScanning) else if (mScanning)
{ {
// Currently scanning, will scan again after completion. // Currently scanning, will scan again after completion.
cLog(lsTRACE) << "Pool: Scan: already scanning"; WriteLog (lsTRACE, ConnectionPool) << "Pool: Scan: already scanning";
nothing(); nothing();
} }
@@ -694,7 +692,7 @@ void ConnectionPool::scanRefresh()
if (tpNow.is_not_a_date_time()) if (tpNow.is_not_a_date_time())
{ {
//cLog(lsINFO) << "Pool: Scan: stop."; //WriteLog (lsINFO, ConnectionPool) << "Pool: Scan: stop.";
(void) mScanTimer.cancel(); (void) mScanTimer.cancel();
} }
@@ -709,7 +707,7 @@ void ConnectionPool::scanRefresh()
tpNext = tpNow + boost::posix_time::seconds(iInterval); tpNext = tpNow + boost::posix_time::seconds(iInterval);
//cLog(lsINFO) << str(boost::format("Pool: Scan: Now: %s %s (next %s, delay=%d)") //WriteLog (lsINFO, ConnectionPool) << str(boost::format("Pool: Scan: Now: %s %s (next %s, delay=%d)")
// % mScanIp % mScanPort % tpNext % (tpNext-tpNow).total_seconds()); // % mScanIp % mScanPort % tpNext % (tpNext-tpNow).total_seconds());
iInterval *= 2; iInterval *= 2;
@@ -734,7 +732,7 @@ void ConnectionPool::scanRefresh()
} }
else else
{ {
//cLog(lsINFO) << str(boost::format("Pool: Scan: Next: %s (next %s, delay=%d)") //WriteLog (lsINFO, ConnectionPool) << str(boost::format("Pool: Scan: Next: %s (next %s, delay=%d)")
// % strIpPort % tpNext % (tpNext-tpNow).total_seconds()); // % strIpPort % tpNext % (tpNext-tpNow).total_seconds());
mScanTimer.expires_at(tpNext); mScanTimer.expires_at(tpNext);

View File

@@ -24,7 +24,6 @@
// code assumes this node is synched (and will continue to do so until // code assumes this node is synched (and will continue to do so until
// there's a functional network. // there's a functional network.
SETUP_LOG();
DECLARE_INSTANCE(InfoSub); DECLARE_INSTANCE(InfoSub);
void InfoSub::onSendEmpty() void InfoSub::onSendEmpty()
@@ -99,7 +98,7 @@ void NetworkOPs::closeTimeOffset(int offset)
mCloseTimeOffset += (offset - 3) / 4; mCloseTimeOffset += (offset - 3) / 4;
else else
mCloseTimeOffset = (mCloseTimeOffset * 3) / 4; mCloseTimeOffset = (mCloseTimeOffset * 3) / 4;
tLog(mCloseTimeOffset != 0, lsINFO) << "Close time offset now " << mCloseTimeOffset; CondLog (mCloseTimeOffset != 0, lsINFO, NetworkOPs) << "Close time offset now " << mCloseTimeOffset;
} }
uint32 NetworkOPs::getLedgerID(const uint256& hash) uint32 NetworkOPs::getLedgerID(const uint256& hash)
@@ -121,7 +120,7 @@ Ledger::pointer NetworkOPs::getLedgerBySeq(const uint32 seq)
return ret; return ret;
// We should have this ledger but we don't // We should have this ledger but we don't
cLog(lsWARNING) << "We should have ledger " << seq; WriteLog (lsWARNING, NetworkOPs) << "We should have ledger " << seq;
return ret; return ret;
} }
@@ -171,13 +170,13 @@ void NetworkOPs::submitTransaction(Job&, SerializedTransaction::pointer iTrans,
int flags; int flags;
if (theApp->isNew(suppress, 0, flags) && ((flags & SF_RETRY) != 0)) if (theApp->isNew(suppress, 0, flags) && ((flags & SF_RETRY) != 0))
{ {
cLog(lsWARNING) << "Redundant transactions submitted"; WriteLog (lsWARNING, NetworkOPs) << "Redundant transactions submitted";
return; return;
} }
if ((flags & SF_BAD) != 0) if ((flags & SF_BAD) != 0)
{ {
cLog(lsWARNING) << "Submitted transaction cached bad"; WriteLog (lsWARNING, NetworkOPs) << "Submitted transaction cached bad";
return; return;
} }
@@ -187,7 +186,7 @@ void NetworkOPs::submitTransaction(Job&, SerializedTransaction::pointer iTrans,
{ {
if (!trans->checkSign()) if (!trans->checkSign())
{ {
cLog(lsWARNING) << "Submitted transaction has bad signature"; WriteLog (lsWARNING, NetworkOPs) << "Submitted transaction has bad signature";
theApp->isNewFlag(suppress, SF_BAD); theApp->isNewFlag(suppress, SF_BAD);
return; return;
} }
@@ -195,7 +194,7 @@ void NetworkOPs::submitTransaction(Job&, SerializedTransaction::pointer iTrans,
} }
catch (...) catch (...)
{ {
cLog(lsWARNING) << "Exception checking transaction " << suppress; WriteLog (lsWARNING, NetworkOPs) << "Exception checking transaction " << suppress;
return; return;
} }
} }
@@ -226,9 +225,9 @@ Transaction::pointer NetworkOPs::submitTransactionSync(Transaction::ref tpTrans,
} }
else else
{ {
cLog(lsFATAL) << "Transaction reconstruction failure"; WriteLog (lsFATAL, NetworkOPs) << "Transaction reconstruction failure";
cLog(lsFATAL) << tpTransNew->getSTransaction()->getJson(0); WriteLog (lsFATAL, NetworkOPs) << tpTransNew->getSTransaction()->getJson(0);
cLog(lsFATAL) << tpTrans->getSTransaction()->getJson(0); WriteLog (lsFATAL, NetworkOPs) << tpTrans->getSTransaction()->getJson(0);
assert(false); assert(false);
@@ -269,25 +268,25 @@ void NetworkOPs::runTransactionQueue()
if (isTerRetry(r)) if (isTerRetry(r))
{ // transaction should be held { // transaction should be held
cLog(lsDEBUG) << "Transaction should be held: " << r; WriteLog (lsDEBUG, NetworkOPs) << "Transaction should be held: " << r;
dbtx->setStatus(HELD); dbtx->setStatus(HELD);
theApp->getMasterTransaction().canonicalize(dbtx, true); theApp->getMasterTransaction().canonicalize(dbtx, true);
mLedgerMaster->addHeldTransaction(dbtx); mLedgerMaster->addHeldTransaction(dbtx);
} }
else if (r == tefPAST_SEQ) else if (r == tefPAST_SEQ)
{ // duplicate or conflict { // duplicate or conflict
cLog(lsINFO) << "Transaction is obsolete"; WriteLog (lsINFO, NetworkOPs) << "Transaction is obsolete";
dbtx->setStatus(OBSOLETE); dbtx->setStatus(OBSOLETE);
} }
else if (r == tesSUCCESS) else if (r == tesSUCCESS)
{ {
cLog(lsINFO) << "Transaction is now included in open ledger"; WriteLog (lsINFO, NetworkOPs) << "Transaction is now included in open ledger";
dbtx->setStatus(INCLUDED); dbtx->setStatus(INCLUDED);
theApp->getMasterTransaction().canonicalize(dbtx, true); theApp->getMasterTransaction().canonicalize(dbtx, true);
} }
else else
{ {
cLog(lsDEBUG) << "Status other than success " << r; WriteLog (lsDEBUG, NetworkOPs) << "Status other than success " << r;
dbtx->setStatus(INVALID); dbtx->setStatus(INVALID);
} }
@@ -332,7 +331,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
{ // signature not checked { // signature not checked
if (!trans->checkSign()) if (!trans->checkSign())
{ {
cLog(lsINFO) << "Transaction has bad signature"; WriteLog (lsINFO, NetworkOPs) << "Transaction has bad signature";
trans->setStatus(INVALID); trans->setStatus(INVALID);
trans->setResult(temBAD_SIGNATURE); trans->setResult(temBAD_SIGNATURE);
theApp->isNewFlag(trans->getID(), SF_BAD); theApp->isNewFlag(trans->getID(), SF_BAD);
@@ -357,7 +356,7 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
if (r != tesSUCCESS) if (r != tesSUCCESS)
{ {
std::string token, human; std::string token, human;
tLog(transResultInfo(r, token, human), lsINFO) << "TransactionResult: " << token << ": " << human; CondLog (transResultInfo(r, token, human), lsINFO, NetworkOPs) << "TransactionResult: " << token << ": " << human;
} }
#endif #endif
@@ -369,25 +368,25 @@ Transaction::pointer NetworkOPs::processTransaction(Transaction::pointer trans,
if (r == tesSUCCESS) if (r == tesSUCCESS)
{ {
cLog(lsINFO) << "Transaction is now included in open ledger"; WriteLog (lsINFO, NetworkOPs) << "Transaction is now included in open ledger";
trans->setStatus(INCLUDED); trans->setStatus(INCLUDED);
theApp->getMasterTransaction().canonicalize(trans, true); theApp->getMasterTransaction().canonicalize(trans, true);
} }
else if (r == tefPAST_SEQ) else if (r == tefPAST_SEQ)
{ // duplicate or conflict { // duplicate or conflict
cLog(lsINFO) << "Transaction is obsolete"; WriteLog (lsINFO, NetworkOPs) << "Transaction is obsolete";
trans->setStatus(OBSOLETE); trans->setStatus(OBSOLETE);
} }
else if (isTerRetry(r)) else if (isTerRetry(r))
{ // transaction should be held { // transaction should be held
cLog(lsDEBUG) << "Transaction should be held: " << r; WriteLog (lsDEBUG, NetworkOPs) << "Transaction should be held: " << r;
trans->setStatus(HELD); trans->setStatus(HELD);
theApp->getMasterTransaction().canonicalize(trans, true); theApp->getMasterTransaction().canonicalize(trans, true);
mLedgerMaster->addHeldTransaction(trans); mLedgerMaster->addHeldTransaction(trans);
} }
else else
{ {
cLog(lsDEBUG) << "Status other than success " << r; WriteLog (lsDEBUG, NetworkOPs) << "Status other than success " << r;
trans->setStatus(INVALID); trans->setStatus(INVALID);
} }
@@ -455,21 +454,21 @@ STVector256 NetworkOPs::getDirNodeInfo(
if (sleNode) if (sleNode)
{ {
cLog(lsDEBUG) << "getDirNodeInfo: node index: " << uNodeIndex.ToString(); WriteLog (lsDEBUG, NetworkOPs) << "getDirNodeInfo: node index: " << uNodeIndex.ToString();
cLog(lsTRACE) << "getDirNodeInfo: first: " << strHex(sleNode->getFieldU64(sfIndexPrevious)); WriteLog (lsTRACE, NetworkOPs) << "getDirNodeInfo: first: " << strHex(sleNode->getFieldU64(sfIndexPrevious));
cLog(lsTRACE) << "getDirNodeInfo: last: " << strHex(sleNode->getFieldU64(sfIndexNext)); WriteLog (lsTRACE, NetworkOPs) << "getDirNodeInfo: last: " << strHex(sleNode->getFieldU64(sfIndexNext));
uNodePrevious = sleNode->getFieldU64(sfIndexPrevious); uNodePrevious = sleNode->getFieldU64(sfIndexPrevious);
uNodeNext = sleNode->getFieldU64(sfIndexNext); uNodeNext = sleNode->getFieldU64(sfIndexNext);
svIndexes = sleNode->getFieldV256(sfIndexes); svIndexes = sleNode->getFieldV256(sfIndexes);
cLog(lsTRACE) << "getDirNodeInfo: first: " << strHex(uNodePrevious); WriteLog (lsTRACE, NetworkOPs) << "getDirNodeInfo: first: " << strHex(uNodePrevious);
cLog(lsTRACE) << "getDirNodeInfo: last: " << strHex(uNodeNext); WriteLog (lsTRACE, NetworkOPs) << "getDirNodeInfo: last: " << strHex(uNodeNext);
} }
else else
{ {
cLog(lsINFO) << "getDirNodeInfo: node index: NOT FOUND: " << uNodeIndex.ToString(); WriteLog (lsINFO, NetworkOPs) << "getDirNodeInfo: node index: NOT FOUND: " << uNodeIndex.ToString();
uNodePrevious = 0; uNodePrevious = 0;
uNodeNext = 0; uNodeNext = 0;
@@ -588,7 +587,7 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
if ((result == boost::asio::error::operation_aborted) || theConfig.RUN_STANDALONE) if ((result == boost::asio::error::operation_aborted) || theConfig.RUN_STANDALONE)
{ {
cLog(lsFATAL) << "Network state timer error: " << result; WriteLog (lsFATAL, NetworkOPs) << "Network state timer error: " << result;
return; return;
} }
@@ -605,7 +604,7 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
if (mMode != omDISCONNECTED) if (mMode != omDISCONNECTED)
{ {
setMode(omDISCONNECTED); setMode(omDISCONNECTED);
cLog(lsWARNING) << "Node count (" << peerList.size() << WriteLog (lsWARNING, NetworkOPs) << "Node count (" << peerList.size() <<
") has fallen below quorum (" << theConfig.NETWORK_QUORUM << ")."; ") has fallen below quorum (" << theConfig.NETWORK_QUORUM << ").";
} }
return; return;
@@ -613,7 +612,7 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
if (mMode == omDISCONNECTED) if (mMode == omDISCONNECTED)
{ {
setMode(omCONNECTED); setMode(omCONNECTED);
cLog(lsINFO) << "Node count (" << peerList.size() << ") is sufficient."; WriteLog (lsINFO, NetworkOPs) << "Node count (" << peerList.size() << ") is sufficient.";
} }
// Check if the last validated ledger forces a change between these states // Check if the last validated ledger forces a change between these states
@@ -671,7 +670,7 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
// agree? And do we have no better ledger available? // agree? And do we have no better ledger available?
// If so, we are either tracking or full. // If so, we are either tracking or full.
cLog(lsTRACE) << "NetworkOPs::checkLastClosedLedger"; WriteLog (lsTRACE, NetworkOPs) << "NetworkOPs::checkLastClosedLedger";
Ledger::pointer ourClosed = mLedgerMaster->getClosedLedger(); Ledger::pointer ourClosed = mLedgerMaster->getClosedLedger();
if (!ourClosed) if (!ourClosed)
@@ -679,8 +678,8 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
uint256 closedLedger = ourClosed->getHash(); uint256 closedLedger = ourClosed->getHash();
uint256 prevClosedLedger = ourClosed->getParentHash(); uint256 prevClosedLedger = ourClosed->getParentHash();
cLog(lsTRACE) << "OurClosed: " << closedLedger; WriteLog (lsTRACE, NetworkOPs) << "OurClosed: " << closedLedger;
cLog(lsTRACE) << "PrevClosed: " << prevClosedLedger; WriteLog (lsTRACE, NetworkOPs) << "PrevClosed: " << prevClosedLedger;
boost::unordered_map<uint256, ValidationCount> ledgers; boost::unordered_map<uint256, ValidationCount> ledgers;
{ {
@@ -728,14 +727,14 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
for (boost::unordered_map<uint256, ValidationCount>::iterator it = ledgers.begin(), end = ledgers.end(); for (boost::unordered_map<uint256, ValidationCount>::iterator it = ledgers.begin(), end = ledgers.end();
it != end; ++it) it != end; ++it)
{ {
cLog(lsDEBUG) << "L: " << it->first << " t=" << it->second.trustedValidations << WriteLog (lsDEBUG, NetworkOPs) << "L: " << it->first << " t=" << it->second.trustedValidations <<
", n=" << it->second.nodesUsing; ", n=" << it->second.nodesUsing;
// Temporary logging to make sure tiebreaking isn't broken // Temporary logging to make sure tiebreaking isn't broken
if (it->second.trustedValidations > 0) if (it->second.trustedValidations > 0)
cLog(lsTRACE) << " TieBreakTV: " << it->second.highValidation; WriteLog (lsTRACE, NetworkOPs) << " TieBreakTV: " << it->second.highValidation;
else else
tLog(it->second.nodesUsing > 0, lsTRACE) << " TieBreakNU: " << it->second.highNodeUsing; CondLog (it->second.nodesUsing > 0, lsTRACE, NetworkOPs) << " TieBreakNU: " << it->second.highNodeUsing;
if (it->second > bestVC) if (it->second > bestVC)
{ {
@@ -747,7 +746,7 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
if (switchLedgers && (closedLedger == prevClosedLedger)) if (switchLedgers && (closedLedger == prevClosedLedger))
{ // don't switch to our own previous ledger { // don't switch to our own previous ledger
cLog(lsINFO) << "We won't switch to our own previous ledger"; WriteLog (lsINFO, NetworkOPs) << "We won't switch to our own previous ledger";
networkClosed = ourClosed->getHash(); networkClosed = ourClosed->getHash();
switchLedgers = false; switchLedgers = false;
} }
@@ -765,22 +764,22 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
return false; return false;
} }
cLog(lsWARNING) << "We are not running on the consensus ledger"; WriteLog (lsWARNING, NetworkOPs) << "We are not running on the consensus ledger";
cLog(lsINFO) << "Our LCL: " << ourClosed->getJson(0); WriteLog (lsINFO, NetworkOPs) << "Our LCL: " << ourClosed->getJson(0);
cLog(lsINFO) << "Net LCL " << closedLedger; WriteLog (lsINFO, NetworkOPs) << "Net LCL " << closedLedger;
if ((mMode == omTRACKING) || (mMode == omFULL)) if ((mMode == omTRACKING) || (mMode == omFULL))
setMode(omCONNECTED); setMode(omCONNECTED);
Ledger::pointer consensus = mLedgerMaster->getLedgerByHash(closedLedger); Ledger::pointer consensus = mLedgerMaster->getLedgerByHash(closedLedger);
if (!consensus) if (!consensus)
{ {
cLog(lsINFO) << "Acquiring consensus ledger " << closedLedger; WriteLog (lsINFO, NetworkOPs) << "Acquiring consensus ledger " << closedLedger;
if (!mAcquiringLedger || (mAcquiringLedger->getHash() != closedLedger)) if (!mAcquiringLedger || (mAcquiringLedger->getHash() != closedLedger))
mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(closedLedger, 0); mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(closedLedger, 0);
if (!mAcquiringLedger || mAcquiringLedger->isFailed()) if (!mAcquiringLedger || mAcquiringLedger->isFailed())
{ {
theApp->getMasterLedgerAcquire().dropLedger(closedLedger); theApp->getMasterLedgerAcquire().dropLedger(closedLedger);
cLog(lsERROR) << "Network ledger cannot be acquired"; WriteLog (lsERROR, NetworkOPs) << "Network ledger cannot be acquired";
return true; return true;
} }
if (!mAcquiringLedger->isComplete()) if (!mAcquiringLedger->isComplete())
@@ -800,9 +799,9 @@ void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger, bool duringCo
{ // set the newledger as our last closed ledger -- this is abnormal code { // set the newledger as our last closed ledger -- this is abnormal code
if (duringConsensus) if (duringConsensus)
cLog(lsERROR) << "JUMPdc last closed ledger to " << newLedger->getHash(); WriteLog (lsERROR, NetworkOPs) << "JUMPdc last closed ledger to " << newLedger->getHash();
else else
cLog(lsERROR) << "JUMP last closed ledger to " << newLedger->getHash(); WriteLog (lsERROR, NetworkOPs) << "JUMP last closed ledger to " << newLedger->getHash();
clearNeedNetworkLedger(); clearNeedNetworkLedger();
newLedger->setClosed(); newLedger->setClosed();
@@ -823,15 +822,15 @@ void NetworkOPs::switchLastClosedLedger(Ledger::pointer newLedger, bool duringCo
int NetworkOPs::beginConsensus(const uint256& networkClosed, Ledger::pointer closingLedger) int NetworkOPs::beginConsensus(const uint256& networkClosed, Ledger::pointer closingLedger)
{ {
cLog(lsINFO) << "Consensus time for ledger " << closingLedger->getLedgerSeq(); WriteLog (lsINFO, NetworkOPs) << "Consensus time for ledger " << closingLedger->getLedgerSeq();
cLog(lsINFO) << " LCL is " << closingLedger->getParentHash(); WriteLog (lsINFO, NetworkOPs) << " LCL is " << closingLedger->getParentHash();
Ledger::pointer prevLedger = mLedgerMaster->getLedgerByHash(closingLedger->getParentHash()); Ledger::pointer prevLedger = mLedgerMaster->getLedgerByHash(closingLedger->getParentHash());
if (!prevLedger) if (!prevLedger)
{ // this shouldn't happen unless we jump ledgers { // this shouldn't happen unless we jump ledgers
if (mMode == omFULL) if (mMode == omFULL)
{ {
cLog(lsWARNING) << "Don't have LCL, going to tracking"; WriteLog (lsWARNING, NetworkOPs) << "Don't have LCL, going to tracking";
setMode(omTRACKING); setMode(omTRACKING);
} }
return 3; return 3;
@@ -845,7 +844,7 @@ int NetworkOPs::beginConsensus(const uint256& networkClosed, Ledger::pointer clo
mConsensus = boost::make_shared<LedgerConsensus>( mConsensus = boost::make_shared<LedgerConsensus>(
networkClosed, prevLedger, mLedgerMaster->getCurrentLedger()->getCloseTimeNC()); networkClosed, prevLedger, mLedgerMaster->getCurrentLedger()->getCloseTimeNC());
cLog(lsDEBUG) << "Initiating consensus engine"; WriteLog (lsDEBUG, NetworkOPs) << "Initiating consensus engine";
return mConsensus->startup(); return mConsensus->startup();
} }
@@ -865,7 +864,7 @@ bool NetworkOPs::haveConsensusObject()
bool ledgerChange = checkLastClosedLedger(peerList, networkClosed); bool ledgerChange = checkLastClosedLedger(peerList, networkClosed);
if (!ledgerChange) if (!ledgerChange)
{ {
cLog(lsINFO) << "Beginning consensus due to peer action"; WriteLog (lsINFO, NetworkOPs) << "Beginning consensus due to peer action";
beginConsensus(networkClosed, mLedgerMaster->getCurrentLedger()); beginConsensus(networkClosed, mLedgerMaster->getCurrentLedger());
} }
} }
@@ -888,7 +887,7 @@ void NetworkOPs::processTrustedProposal(LedgerProposal::pointer proposal,
if (!haveConsensusObject()) if (!haveConsensusObject())
{ {
cLog(lsINFO) << "Received proposal outside consensus window"; WriteLog (lsINFO, NetworkOPs) << "Received proposal outside consensus window";
if (mMode == omFULL) if (mMode == omFULL)
relay = false; relay = false;
} }
@@ -900,7 +899,7 @@ void NetworkOPs::processTrustedProposal(LedgerProposal::pointer proposal,
if (!set->has_previousledger() && (checkLedger != consensusLCL)) if (!set->has_previousledger() && (checkLedger != consensusLCL))
{ {
cLog(lsWARNING) << "Have to re-check proposal signature due to consensus view change"; WriteLog (lsWARNING, NetworkOPs) << "Have to re-check proposal signature due to consensus view change";
assert(proposal->hasSignature()); assert(proposal->hasSignature());
proposal->setPrevLedger(consensusLCL); proposal->setPrevLedger(consensusLCL);
if (proposal->checkSign()) if (proposal->checkSign())
@@ -910,7 +909,7 @@ void NetworkOPs::processTrustedProposal(LedgerProposal::pointer proposal,
if (sigGood && (consensusLCL == proposal->getPrevLedger())) if (sigGood && (consensusLCL == proposal->getPrevLedger()))
{ {
relay = mConsensus->peerPosition(proposal); relay = mConsensus->peerPosition(proposal);
cLog(lsTRACE) << "Proposal processing finished, relay=" << relay; WriteLog (lsTRACE, NetworkOPs) << "Proposal processing finished, relay=" << relay;
} }
} }
@@ -922,7 +921,7 @@ void NetworkOPs::processTrustedProposal(LedgerProposal::pointer proposal,
theApp->getConnectionPool().relayMessageBut(peers, message); theApp->getConnectionPool().relayMessageBut(peers, message);
} }
else else
cLog(lsINFO) << "Not relaying trusted proposal"; WriteLog (lsINFO, NetworkOPs) << "Not relaying trusted proposal";
} }
SHAMap::pointer NetworkOPs::getTXMap(const uint256& hash) SHAMap::pointer NetworkOPs::getTXMap(const uint256& hash)
@@ -958,7 +957,7 @@ SMAddNode NetworkOPs::gotTXData(const boost::shared_ptr<Peer>& peer, const uint2
{ {
if (!haveConsensusObject()) if (!haveConsensusObject())
{ {
cLog(lsWARNING) << "Got TX data with no consensus object"; WriteLog (lsWARNING, NetworkOPs) << "Got TX data with no consensus object";
return SMAddNode(); return SMAddNode();
} }
return mConsensus->peerGaveNodes(peer, hash, nodeIDs, nodeData); return mConsensus->peerGaveNodes(peer, hash, nodeIDs, nodeData);
@@ -968,7 +967,7 @@ bool NetworkOPs::hasTXSet(const boost::shared_ptr<Peer>& peer, const uint256& se
{ {
if (!haveConsensusObject()) if (!haveConsensusObject())
{ {
cLog(lsINFO) << "Peer has TX set, not during consensus"; WriteLog (lsINFO, NetworkOPs) << "Peer has TX set, not during consensus";
return false; return false;
} }
return mConsensus->peerHasSet(peer, set, status); return mConsensus->peerHasSet(peer, set, status);
@@ -994,7 +993,7 @@ void NetworkOPs::endConsensus(bool correctLCL)
BOOST_FOREACH(Peer::ref it, peerList) BOOST_FOREACH(Peer::ref it, peerList)
if (it && (it->getClosedLedgerHash() == deadLedger)) if (it && (it->getClosedLedgerHash() == deadLedger))
{ {
cLog(lsTRACE) << "Killing obsolete peer status"; WriteLog (lsTRACE, NetworkOPs) << "Killing obsolete peer status";
it->cycleStatus(); it->cycleStatus();
} }
mConsensus = boost::shared_ptr<LedgerConsensus>(); mConsensus = boost::shared_ptr<LedgerConsensus>();
@@ -1104,7 +1103,7 @@ std::string
% boost::lexical_cast<std::string>(offset) % boost::lexical_cast<std::string>(offset)
% boost::lexical_cast<std::string>(numberOfResults) % boost::lexical_cast<std::string>(numberOfResults)
); );
cLog(lsTRACE) << "txSQL query: " << sql; WriteLog (lsTRACE, NetworkOPs) << "txSQL query: " << sql;
return sql; return sql;
} }
@@ -1228,7 +1227,7 @@ std::vector<RippleAddress>
bool NetworkOPs::recvValidation(SerializedValidation::ref val, const std::string& source) bool NetworkOPs::recvValidation(SerializedValidation::ref val, const std::string& source)
{ {
cLog(lsDEBUG) << "recvValidation " << val->getLedgerHash() << " from " << source; WriteLog (lsDEBUG, NetworkOPs) << "recvValidation " << val->getLedgerHash() << " from " << source;
return theApp->getValidations().addValidation(val, source); return theApp->getValidations().addValidation(val, source);
} }
@@ -1382,7 +1381,7 @@ void NetworkOPs::pubProposedTransaction(Ledger::ref lpCurrent, SerializedTransac
} }
} }
ALTransaction alt(stTxn, terResult); ALTransaction alt(stTxn, terResult);
cLog(lsTRACE) << "pubProposed: " << alt.getJson(); WriteLog (lsTRACE, NetworkOPs) << "pubProposed: " << alt.getJson();
pubAccountTransaction(lpCurrent, ALTransaction(stTxn, terResult), false); pubAccountTransaction(lpCurrent, ALTransaction(stTxn, terResult), false);
} }
@@ -1436,7 +1435,7 @@ void NetworkOPs::pubLedger(Ledger::ref accepted)
{ {
BOOST_FOREACH(const AcceptedLedger::value_type& vt, alpAccepted->getMap()) BOOST_FOREACH(const AcceptedLedger::value_type& vt, alpAccepted->getMap())
{ {
cLog(lsTRACE) << "pubAccepted: " << vt.second->getJson(); WriteLog (lsTRACE, NetworkOPs) << "pubAccepted: " << vt.second->getJson();
pubValidatedTransaction(lpAccepted, *vt.second); pubValidatedTransaction(lpAccepted, *vt.second);
} }
} }
@@ -1577,7 +1576,7 @@ void NetworkOPs::pubAccountTransaction(Ledger::ref lpCurrent, const ALTransactio
} }
} }
} }
cLog(lsINFO) << boost::str(boost::format("pubAccountTransaction: iProposed=%d iAccepted=%d") % iProposed % iAccepted); WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("pubAccountTransaction: iProposed=%d iAccepted=%d") % iProposed % iAccepted);
if (!notify.empty()) if (!notify.empty())
{ {
@@ -1604,7 +1603,7 @@ void NetworkOPs::subAccount(InfoSub::ref isrListener, const boost::unordered_set
// For the connection, monitor each account. // For the connection, monitor each account.
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs) BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
{ {
cLog(lsTRACE) << boost::str(boost::format("subAccount: account: %d") % naAccountID.humanAccountID()); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("subAccount: account: %d") % naAccountID.humanAccountID());
isrListener->insertSubAccountInfo(naAccountID, uLedgerIndex); isrListener->insertSubAccountInfo(naAccountID, uLedgerIndex);
} }
@@ -1845,11 +1844,11 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
const uint256 uBookEnd = Ledger::getQualityNext(uBookBase); const uint256 uBookEnd = Ledger::getQualityNext(uBookBase);
uint256 uTipIndex = uBookBase; uint256 uTipIndex = uBookBase;
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uTakerPaysCurrencyID=%s uTakerPaysIssuerID=%s") % STAmount::createHumanCurrency(uTakerPaysCurrencyID) % RippleAddress::createHumanAccountID(uTakerPaysIssuerID)); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uTakerPaysCurrencyID=%s uTakerPaysIssuerID=%s") % STAmount::createHumanCurrency(uTakerPaysCurrencyID) % RippleAddress::createHumanAccountID(uTakerPaysIssuerID));
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uTakerGetsCurrencyID=%s uTakerGetsIssuerID=%s") % STAmount::createHumanCurrency(uTakerGetsCurrencyID) % RippleAddress::createHumanAccountID(uTakerGetsIssuerID)); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uTakerGetsCurrencyID=%s uTakerGetsIssuerID=%s") % STAmount::createHumanCurrency(uTakerGetsCurrencyID) % RippleAddress::createHumanAccountID(uTakerGetsIssuerID));
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uBookBase=%s") % uBookBase); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uBookBase=%s") % uBookBase);
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uBookEnd=%s") % uBookEnd); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uBookEnd=%s") % uBookEnd);
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uTipIndex=%s") % uTipIndex); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uTipIndex=%s") % uTipIndex);
LedgerEntrySet lesActive(lpLedger, tapNONE, true); LedgerEntrySet lesActive(lpLedger, tapNONE, true);
@@ -1871,12 +1870,12 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
if (bDirectAdvance) { if (bDirectAdvance) {
bDirectAdvance = false; bDirectAdvance = false;
cLog(lsTRACE) << "getBookPage: bDirectAdvance"; WriteLog (lsTRACE, NetworkOPs) << "getBookPage: bDirectAdvance";
sleOfferDir = lesActive.entryCache(ltDIR_NODE, lpLedger->getNextLedgerIndex(uTipIndex, uBookEnd)); sleOfferDir = lesActive.entryCache(ltDIR_NODE, lpLedger->getNextLedgerIndex(uTipIndex, uBookEnd));
if (!sleOfferDir) if (!sleOfferDir)
{ {
cLog(lsTRACE) << "getBookPage: bDone"; WriteLog (lsTRACE, NetworkOPs) << "getBookPage: bDone";
bDone = true; bDone = true;
} }
else else
@@ -1887,8 +1886,8 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
lesActive.dirFirst(uTipIndex, sleBookNode, uBookEntry, uOfferIndex); lesActive.dirFirst(uTipIndex, sleBookNode, uBookEntry, uOfferIndex);
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uTipIndex=%s") % uTipIndex); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uTipIndex=%s") % uTipIndex);
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uOfferIndex=%s") % uOfferIndex); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uOfferIndex=%s") % uOfferIndex);
} }
} }
@@ -1914,14 +1913,14 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
// Found in running balance table. // Found in running balance table.
saOwnerFunds = umBalanceEntry->second; saOwnerFunds = umBalanceEntry->second;
// cLog(lsINFO) << boost::str(boost::format("getBookPage: saOwnerFunds=%s (cached)") % saOwnerFunds.getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: saOwnerFunds=%s (cached)") % saOwnerFunds.getFullText());
} }
else else
{ {
// Did not find balance in table. // Did not find balance in table.
saOwnerFunds = lesActive.accountHolds(uOfferOwnerID, uTakerGetsCurrencyID, uTakerGetsIssuerID); saOwnerFunds = lesActive.accountHolds(uOfferOwnerID, uTakerGetsCurrencyID, uTakerGetsIssuerID);
// cLog(lsINFO) << boost::str(boost::format("getBookPage: saOwnerFunds=%s (new)") % saOwnerFunds.getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: saOwnerFunds=%s (new)") % saOwnerFunds.getFullText());
if (saOwnerFunds.isNegative()) if (saOwnerFunds.isNegative())
{ {
// Treat negative funds as zero. // Treat negative funds as zero.
@@ -1958,12 +1957,12 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
} }
else else
{ {
// cLog(lsINFO) << boost::str(boost::format("getBookPage: saTakerGets=%s") % saTakerGets.getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: saTakerGets=%s") % saTakerGets.getFullText());
// cLog(lsINFO) << boost::str(boost::format("getBookPage: saTakerPays=%s") % saTakerPays.getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: saTakerPays=%s") % saTakerPays.getFullText());
// cLog(lsINFO) << boost::str(boost::format("getBookPage: saOwnerFunds=%s") % saOwnerFunds.getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: saOwnerFunds=%s") % saOwnerFunds.getFullText());
// cLog(lsINFO) << boost::str(boost::format("getBookPage: saDirRate=%s") % saDirRate.getText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: saDirRate=%s") % saDirRate.getText());
// cLog(lsINFO) << boost::str(boost::format("getBookPage: multiply=%s") % STAmount::multiply(saTakerGetsFunded, saDirRate).getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: multiply=%s") % STAmount::multiply(saTakerGetsFunded, saDirRate).getFullText());
// cLog(lsINFO) << boost::str(boost::format("getBookPage: multiply=%s") % STAmount::multiply(saTakerGetsFunded, saDirRate, saTakerPays).getFullText()); // WriteLog (lsINFO, NetworkOPs) << boost::str(boost::format("getBookPage: multiply=%s") % STAmount::multiply(saTakerGetsFunded, saDirRate, saTakerPays).getFullText());
// Only provide, if not fully funded. // Only provide, if not fully funded.
@@ -1993,7 +1992,7 @@ void NetworkOPs::getBookPage(Ledger::pointer lpLedger, const uint160& uTakerPays
} }
else else
{ {
cLog(lsTRACE) << boost::str(boost::format("getBookPage: uOfferIndex=%s") % uOfferIndex); WriteLog (lsTRACE, NetworkOPs) << boost::str(boost::format("getBookPage: uOfferIndex=%s") % uOfferIndex);
} }
} }
} }
@@ -2008,12 +2007,12 @@ void NetworkOPs::makeFetchPack(Job&, boost::weak_ptr<Peer> wPeer,
{ {
if (upTime() > (uUptime + 1)) if (upTime() > (uUptime + 1))
{ {
cLog(lsINFO) << "Fetch pack request got stale"; WriteLog (lsINFO, NetworkOPs) << "Fetch pack request got stale";
return; return;
} }
if (theApp->getFeeTrack().isLoaded()) if (theApp->getFeeTrack().isLoaded())
{ {
cLog(lsINFO) << "Too busy to make fetch pack"; WriteLog (lsINFO, NetworkOPs) << "Too busy to make fetch pack";
return; return;
} }
@@ -2069,13 +2068,13 @@ void NetworkOPs::makeFetchPack(Job&, boost::weak_ptr<Peer> wPeer,
wantLedger = getLedgerByHash(haveLedger->getParentHash()); wantLedger = getLedgerByHash(haveLedger->getParentHash());
} while (wantLedger && (upTime() <= (uUptime + 1))); } while (wantLedger && (upTime() <= (uUptime + 1)));
cLog(lsINFO) << "Built fetch pack with " << reply.objects().size() << " nodes"; WriteLog (lsINFO, NetworkOPs) << "Built fetch pack with " << reply.objects().size() << " nodes";
PackedMessage::pointer msg = boost::make_shared<PackedMessage>(reply, ripple::mtGET_OBJECTS); PackedMessage::pointer msg = boost::make_shared<PackedMessage>(reply, ripple::mtGET_OBJECTS);
peer->sendPacket(msg, false); peer->sendPacket(msg, false);
} }
catch (...) catch (...)
{ {
cLog(lsWARNING) << "Exception building fetch pach"; WriteLog (lsWARNING, NetworkOPs) << "Exception building fetch pach";
} }
} }
@@ -2097,7 +2096,7 @@ bool NetworkOPs::getFetchPack(const uint256& hash, std::vector<unsigned char>& d
mFetchPack.del(hash, false); mFetchPack.del(hash, false);
if (hash != Serializer::getSHA512Half(data)) if (hash != Serializer::getSHA512Half(data))
{ {
cLog(lsWARNING) << "Bad entry in fetch pack"; WriteLog (lsWARNING, NetworkOPs) << "Bad entry in fetch pack";
return false; return false;
} }
return true; return true;
@@ -2136,7 +2135,7 @@ void NetworkOPs::gotFetchPack(bool progress, uint32 seq)
void NetworkOPs::missingNodeInLedger(uint32 seq) void NetworkOPs::missingNodeInLedger(uint32 seq)
{ {
cLog(lsWARNING) << "We are missing a node in ledger " << seq; WriteLog (lsWARNING, NetworkOPs) << "We are missing a node in ledger " << seq;
uint256 hash = theApp->getLedgerMaster().getHashBySeq(seq); uint256 hash = theApp->getLedgerMaster().getHashBySeq(seq);
if (hash.isNonZero()) if (hash.isNonZero())
theApp->getMasterLedgerAcquire().findCreate(hash, seq); theApp->getMasterLedgerAcquire().findCreate(hash, seq);

View File

@@ -15,7 +15,6 @@
#include "utils.h" #include "utils.h"
#include "Log.h" #include "Log.h"
SETUP_LOG();
DECLARE_INSTANCE(Peer); DECLARE_INSTANCE(Peer);
// Don't try to run past receiving nonsense from a peer // Don't try to run past receiving nonsense from a peer
@@ -42,7 +41,7 @@ Peer::Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx,
mActivityTimer(io_service), mActivityTimer(io_service),
mIOStrand(io_service) mIOStrand(io_service)
{ {
cLog(lsDEBUG) << "CREATING PEER: " << ADDRESS(this); WriteLog (lsDEBUG, Peer) << "CREATING PEER: " << ADDRESS(this);
} }
void Peer::handleWrite(const boost::system::error_code& error, size_t bytes_transferred) void Peer::handleWrite(const boost::system::error_code& error, size_t bytes_transferred)
@@ -61,7 +60,7 @@ void Peer::handleWrite(const boost::system::error_code& error, size_t bytes_tran
} }
else if (error) else if (error)
{ {
cLog(lsINFO) << "Peer: Write: Error: " << ADDRESS(this) << ": bytes=" << bytes_transferred << ": " << error.category().name() << ": " << error.message() << ": " << error; WriteLog (lsINFO, Peer) << "Peer: Write: Error: " << ADDRESS(this) << ": bytes=" << bytes_transferred << ": " << error.category().name() << ": " << error.message() << ": " << error;
detach("hw", true); detach("hw", true);
} }
@@ -82,7 +81,7 @@ void Peer::setIpPort(const std::string& strIP, int iPort)
mIpPort = make_pair(strIP, iPort); mIpPort = make_pair(strIP, iPort);
mLoad.rename(strIP); mLoad.rename(strIP);
cLog(lsDEBUG) << "Peer: Set: " WriteLog (lsDEBUG, Peer) << "Peer: Set: "
<< ADDRESS(this) << "> " << ADDRESS(this) << "> "
<< (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort(); << (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort();
} }
@@ -98,9 +97,9 @@ void Peer::detach(const char *rsn, bool onIOStrand)
{ {
mDetaching = true; // Race is ok. mDetaching = true; // Race is ok.
tLog(mCluster, lsWARNING) << "Cluster peer detach \"" << mNodeName << "\": " << rsn; CondLog (mCluster, lsWARNING, Peer) << "Cluster peer detach \"" << mNodeName << "\": " << rsn;
/* /*
cLog(lsDEBUG) << "Peer: Detach: " WriteLog (lsDEBUG, Peer) << "Peer: Detach: "
<< ADDRESS(this) << "> " << ADDRESS(this) << "> "
<< rsn << ": " << rsn << ": "
<< (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort(); << (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort();
@@ -128,7 +127,7 @@ void Peer::detach(const char *rsn, bool onIOStrand)
mIpPort.first.clear(); // Be idempotent. mIpPort.first.clear(); // Be idempotent.
} }
/* /*
cLog(lsDEBUG) << "Peer: Detach: " WriteLog (lsDEBUG, Peer) << "Peer: Detach: "
<< ADDRESS(this) << "< " << ADDRESS(this) << "< "
<< rsn << ": " << rsn << ": "
<< (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort(); << (mNodePublic.isValid() ? mNodePublic.humanNodePublic() : "-") << " " << getIP() << " " << getPort();
@@ -174,11 +173,11 @@ void Peer::handleVerifyTimer(const boost::system::error_code& ecResult)
} }
else if (ecResult) else if (ecResult)
{ {
cLog(lsINFO) << "Peer verify timer error"; WriteLog (lsINFO, Peer) << "Peer verify timer error";
} }
else else
{ {
//cLog(lsINFO) << "Peer: Verify: Peer failed to verify in time."; //WriteLog (lsINFO, Peer) << "Peer: Verify: Peer failed to verify in time.";
detach("hvt", true); detach("hvt", true);
} }
@@ -204,7 +203,7 @@ void Peer::connect(const std::string& strIp, int iPort)
if (err || itrEndpoint == boost::asio::ip::tcp::resolver::iterator()) if (err || itrEndpoint == boost::asio::ip::tcp::resolver::iterator())
{ {
cLog(lsWARNING) << "Peer: Connect: Bad IP: " << strIp; WriteLog (lsWARNING, Peer) << "Peer: Connect: Bad IP: " << strIp;
detach("c", false); detach("c", false);
return; return;
} }
@@ -216,7 +215,7 @@ void Peer::connect(const std::string& strIp, int iPort)
if (err) if (err)
{ {
cLog(lsWARNING) << "Peer: Connect: Failed to set timer."; WriteLog (lsWARNING, Peer) << "Peer: Connect: Failed to set timer.";
detach("c2", false); detach("c2", false);
return; return;
} }
@@ -224,7 +223,7 @@ void Peer::connect(const std::string& strIp, int iPort)
if (!err) if (!err)
{ {
cLog(lsINFO) << "Peer: Connect: Outbound: " << ADDRESS(this) << ": " << mIpPort.first << " " << mIpPort.second; WriteLog (lsINFO, Peer) << "Peer: Connect: Outbound: " << ADDRESS(this) << ": " << mIpPort.first << " " << mIpPort.second;
boost::asio::async_connect( boost::asio::async_connect(
getSocket(), getSocket(),
@@ -245,7 +244,7 @@ void Peer::handleStart(const boost::system::error_code& error)
{ {
if (error) if (error)
{ {
cLog(lsINFO) << "Peer: Handshake: Error: " << error.category().name() << ": " << error.message() << ": " << error; WriteLog (lsINFO, Peer) << "Peer: Handshake: Error: " << error.category().name() << ": " << error.message() << ": " << error;
detach("hs", true); detach("hs", true);
} }
else else
@@ -260,12 +259,12 @@ void Peer::handleConnect(const boost::system::error_code& error, boost::asio::ip
{ {
if (error) if (error)
{ {
cLog(lsINFO) << "Peer: Connect: Error: " << error.category().name() << ": " << error.message() << ": " << error; WriteLog (lsINFO, Peer) << "Peer: Connect: Error: " << error.category().name() << ": " << error.message() << ": " << error;
detach("hc", true); detach("hc", true);
} }
else else
{ {
cLog(lsINFO) << "Connect peer: success."; WriteLog (lsINFO, Peer) << "Connect peer: success.";
mSocketSsl.set_verify_mode(boost::asio::ssl::verify_none); mSocketSsl.set_verify_mode(boost::asio::ssl::verify_none);
@@ -292,7 +291,7 @@ void Peer::connected(const boost::system::error_code& error)
{ {
// Not redundant ip and port, handshake, and start. // Not redundant ip and port, handshake, and start.
cLog(lsINFO) << "Peer: Inbound: Accepted: " << ADDRESS(this) << ": " << strIp << " " << iPort; WriteLog (lsINFO, Peer) << "Peer: Inbound: Accepted: " << ADDRESS(this) << ": " << strIp << " " << iPort;
mSocketSsl.set_verify_mode(boost::asio::ssl::verify_none); mSocketSsl.set_verify_mode(boost::asio::ssl::verify_none);
@@ -302,7 +301,7 @@ void Peer::connected(const boost::system::error_code& error)
} }
else if (!mDetaching) else if (!mDetaching)
{ {
cLog(lsINFO) << "Peer: Inbound: Error: " << ADDRESS(this) << ": " << strIp << " " << iPort << " : " << error.category().name() << ": " << error.message() << ": " << error; WriteLog (lsINFO, Peer) << "Peer: Inbound: Error: " << ADDRESS(this) << ": " << strIp << " " << iPort << " : " << error.category().name() << ": " << error.message() << ": " << error;
detach("ctd", false); detach("ctd", false);
} }
@@ -390,12 +389,12 @@ void Peer::handleReadHeader(const boost::system::error_code& error)
{ {
if (mCluster) if (mCluster)
{ {
cLog(lsINFO) << "Peer: Cluster connection lost to \"" << mNodeName << "\": " << WriteLog (lsINFO, Peer) << "Peer: Cluster connection lost to \"" << mNodeName << "\": " <<
error.category().name() << ": " << error.message() << ": " << error; error.category().name() << ": " << error.message() << ": " << error;
} }
else else
{ {
cLog(lsINFO) << "Peer: Header: Error: " << getIP() << ": " << error.category().name() << ": " << error.message() << ": " << error; WriteLog (lsINFO, Peer) << "Peer: Header: Error: " << getIP() << ": " << error.category().name() << ": " << error.message() << ": " << error;
} }
detach("hrh2", true); detach("hrh2", true);
} }
@@ -411,12 +410,12 @@ void Peer::handleReadBody(const boost::system::error_code& error)
{ {
if (mCluster) if (mCluster)
{ {
cLog(lsINFO) << "Peer: Cluster connection lost to \"" << mNodeName << "\": " << WriteLog (lsINFO, Peer) << "Peer: Cluster connection lost to \"" << mNodeName << "\": " <<
error.category().name() << ": " << error.message() << ": " << error; error.category().name() << ": " << error.message() << ": " << error;
} }
else else
{ {
cLog(lsINFO) << "Peer: Body: Error: " << getIP() << ": " << error.category().name() << ": " << error.message() << ": " << error; WriteLog (lsINFO, Peer) << "Peer: Body: Error: " << getIP() << ": " << error.category().name() << ": " << error.message() << ": " << error;
} }
boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock()); boost::recursive_mutex::scoped_lock sl(theApp->getMasterLock());
detach("hrb", true); detach("hrb", true);
@@ -443,7 +442,7 @@ void Peer::processReadBuffer()
// If connected and get a mtHELLO or if not connected and get a non-mtHELLO, wrong message was sent. // If connected and get a mtHELLO or if not connected and get a non-mtHELLO, wrong message was sent.
if (mHelloed == (type == ripple::mtHELLO)) if (mHelloed == (type == ripple::mtHELLO))
{ {
cLog(lsWARNING) << "Wrong message type: " << type; WriteLog (lsWARNING, Peer) << "Wrong message type: " << type;
detach("prb1", true); detach("prb1", true);
} }
else else
@@ -457,7 +456,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvHello(msg); recvHello(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -468,7 +467,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvErrorMessage(msg); recvErrorMessage(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -479,7 +478,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvPing(msg); recvPing(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -490,7 +489,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvGetContacts(msg); recvGetContacts(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -502,7 +501,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvContact(msg); recvContact(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -514,7 +513,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvGetPeers(msg, sl); recvGetPeers(msg, sl);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -526,7 +525,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvPeers(msg); recvPeers(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -537,7 +536,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvSearchTransaction(msg); recvSearchTransaction(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -548,7 +547,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvGetAccount(msg); recvGetAccount(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -559,7 +558,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvAccount(msg); recvAccount(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -570,7 +569,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvTransaction(msg, sl); recvTransaction(msg, sl);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -581,7 +580,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvStatus(msg); recvStatus(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -592,7 +591,7 @@ void Peer::processReadBuffer()
if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvPropose(msg); recvPropose(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -603,7 +602,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvGetLedger(msg, sl); recvGetLedger(msg, sl);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -614,7 +613,7 @@ void Peer::processReadBuffer()
if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvLedger(msg, sl); recvLedger(msg, sl);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -625,7 +624,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvHaveTxSet(msg); recvHaveTxSet(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -636,7 +635,7 @@ void Peer::processReadBuffer()
if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvValidation(msg, sl); recvValidation(msg, sl);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
#if 0 #if 0
@@ -646,7 +645,7 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recv(msg); recv(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -658,7 +657,7 @@ void Peer::processReadBuffer()
if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg->ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvGetObjectByHash(msg); recvGetObjectByHash(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
@@ -669,15 +668,15 @@ void Peer::processReadBuffer()
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE)) if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
recvProofWork(msg); recvProofWork(msg);
else else
cLog(lsWARNING) << "parse error: " << type; WriteLog (lsWARNING, Peer) << "parse error: " << type;
} }
break; break;
default: default:
event->reName("Peer::unknown"); event->reName("Peer::unknown");
cLog(lsWARNING) << "Unknown Msg: " << type; WriteLog (lsWARNING, Peer) << "Unknown Msg: " << type;
cLog(lsWARNING) << strHex(&mReadbuf[0], mReadbuf.size()); WriteLog (lsWARNING, Peer) << strHex(&mReadbuf[0], mReadbuf.size());
} }
} }
} }
@@ -707,14 +706,14 @@ void Peer::recvHello(ripple::TMHello& packet)
{ {
int64 to = ourTime; int64 to = ourTime;
to -= packet.nettime(); to -= packet.nettime();
cLog(lsDEBUG) << "Connect: time offset " << to; WriteLog (lsDEBUG, Peer) << "Connect: time offset " << to;
} }
#endif #endif
if ((packet.has_testnet() && packet.testnet()) != theConfig.TESTNET) if ((packet.has_testnet() && packet.testnet()) != theConfig.TESTNET)
{ {
// Format: actual/requested. // Format: actual/requested.
cLog(lsINFO) << boost::str(boost::format("Recv(Hello): Network mismatch: %d/%d") WriteLog (lsINFO, Peer) << boost::str(boost::format("Recv(Hello): Network mismatch: %d/%d")
% packet.testnet() % packet.testnet()
% theConfig.TESTNET); % theConfig.TESTNET);
} }
@@ -722,31 +721,31 @@ void Peer::recvHello(ripple::TMHello& packet)
{ {
if (packet.nettime() > maxTime) if (packet.nettime() > maxTime)
{ {
cLog(lsINFO) << "Recv(Hello): " << getIP() << " :Clock far off +" << packet.nettime() - ourTime; WriteLog (lsINFO, Peer) << "Recv(Hello): " << getIP() << " :Clock far off +" << packet.nettime() - ourTime;
} }
else if(packet.nettime() < minTime) else if(packet.nettime() < minTime)
{ {
cLog(lsINFO) << "Recv(Hello): " << getIP() << " :Clock far off -" << ourTime - packet.nettime(); WriteLog (lsINFO, Peer) << "Recv(Hello): " << getIP() << " :Clock far off -" << ourTime - packet.nettime();
} }
} }
else if (packet.protoversionmin() > MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR)) else if (packet.protoversionmin() > MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR))
{ {
cLog(lsINFO) << "Recv(Hello): Server requires protocol version " << WriteLog (lsINFO, Peer) << "Recv(Hello): Server requires protocol version " <<
GET_VERSION_MAJOR(packet.protoversion()) << "." << GET_VERSION_MINOR(packet.protoversion()) GET_VERSION_MAJOR(packet.protoversion()) << "." << GET_VERSION_MINOR(packet.protoversion())
<< " we run " << PROTO_VERSION_MAJOR << "." << PROTO_VERSION_MINOR; << " we run " << PROTO_VERSION_MAJOR << "." << PROTO_VERSION_MINOR;
} }
else if (!mNodePublic.setNodePublic(packet.nodepublic())) else if (!mNodePublic.setNodePublic(packet.nodepublic()))
{ {
cLog(lsINFO) << "Recv(Hello): Disconnect: Bad node public key."; WriteLog (lsINFO, Peer) << "Recv(Hello): Disconnect: Bad node public key.";
} }
else if (!mNodePublic.verifyNodePublic(mCookieHash, packet.nodeproof())) else if (!mNodePublic.verifyNodePublic(mCookieHash, packet.nodeproof()))
{ // Unable to verify they have private key for claimed public key. { // Unable to verify they have private key for claimed public key.
cLog(lsINFO) << "Recv(Hello): Disconnect: Failed to verify session."; WriteLog (lsINFO, Peer) << "Recv(Hello): Disconnect: Failed to verify session.";
} }
else else
{ // Successful connection. { // Successful connection.
cLog(lsINFO) << "Recv(Hello): Connect: " << mNodePublic.humanNodePublic(); WriteLog (lsINFO, Peer) << "Recv(Hello): Connect: " << mNodePublic.humanNodePublic();
tLog(packet.protoversion() != MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR), lsINFO) CondLog (packet.protoversion() != MAKE_VERSION_INT(PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR), lsINFO, Peer)
<< "Peer speaks version " << << "Peer speaks version " <<
(packet.protoversion() >> 16) << "." << (packet.protoversion() & 0xFF); (packet.protoversion() >> 16) << "." << (packet.protoversion() & 0xFF);
mHello = packet; mHello = packet;
@@ -754,7 +753,7 @@ void Peer::recvHello(ripple::TMHello& packet)
{ {
mCluster = true; mCluster = true;
mLoad.setPrivileged(); mLoad.setPrivileged();
cLog(lsINFO) << "Cluster connection to \"" << (mNodeName.empty() ? getIP() : mNodeName) WriteLog (lsINFO, Peer) << "Cluster connection to \"" << (mNodeName.empty() ? getIP() : mNodeName)
<< "\" established"; << "\" established";
} }
if (isOutbound()) if (isOutbound())
@@ -768,7 +767,7 @@ void Peer::recvHello(ripple::TMHello& packet)
if (!theApp->getConnectionPool().peerConnected(shared_from_this(), mNodePublic, getIP(), getPort())) if (!theApp->getConnectionPool().peerConnected(shared_from_this(), mNodePublic, getIP(), getPort()))
{ // Already connected, self, or some other reason. { // Already connected, self, or some other reason.
cLog(lsINFO) << "Recv(Hello): Disconnect: Extraneous connection."; WriteLog (lsINFO, Peer) << "Recv(Hello): Disconnect: Extraneous connection.";
} }
else else
{ {
@@ -785,7 +784,7 @@ void Peer::recvHello(ripple::TMHello& packet)
if (mHello.nodeprivate()) if (mHello.nodeprivate())
{ {
cLog(lsINFO) << boost::str(boost::format("Recv(Hello): Private connection: %s %s") % strIP % iPort); WriteLog (lsINFO, Peer) << boost::str(boost::format("Recv(Hello): Private connection: %s %s") % strIP % iPort);
} }
else else
{ {
@@ -888,7 +887,7 @@ void Peer::recvTransaction(ripple::TMTransaction& packet, ScopedLock& MasterLock
if ((flags & SF_RETRY) == 0) if ((flags & SF_RETRY) == 0)
return; return;
} }
cLog(lsDEBUG) << "Got new transaction from peer"; WriteLog (lsDEBUG, Peer) << "Got new transaction from peer";
if (mCluster) if (mCluster)
flags |= SF_TRUSTED | SF_SIGGOOD; flags |= SF_TRUSTED | SF_SIGGOOD;
@@ -917,7 +916,7 @@ static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packe
bool sigGood = false; bool sigGood = false;
bool isTrusted = (job.getType() == jtPROPOSAL_t); bool isTrusted = (job.getType() == jtPROPOSAL_t);
cLog(lsTRACE) << "Checking " << (isTrusted ? "trusted" : "UNtrusted") << " proposal"; WriteLog (lsTRACE, Peer) << "Checking " << (isTrusted ? "trusted" : "UNtrusted") << " proposal";
assert(packet); assert(packet);
ripple::TMProposeSet& set = *packet; ripple::TMProposeSet& set = *packet;
@@ -925,12 +924,12 @@ static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packe
uint256 prevLedger; uint256 prevLedger;
if (set.has_previousledger()) if (set.has_previousledger())
{ // proposal includes a previous ledger { // proposal includes a previous ledger
cLog(lsTRACE) << "proposal with previous ledger"; WriteLog (lsTRACE, Peer) << "proposal with previous ledger";
memcpy(prevLedger.begin(), set.previousledger().data(), 256 / 8); memcpy(prevLedger.begin(), set.previousledger().data(), 256 / 8);
if (!proposal->checkSign(set.signature())) if (!proposal->checkSign(set.signature()))
{ {
Peer::pointer p = peer.lock(); Peer::pointer p = peer.lock();
cLog(lsWARNING) << "proposal with previous ledger fails signature check: " << WriteLog (lsWARNING, Peer) << "proposal with previous ledger fails signature check: " <<
(p ? p->getIP() : std::string("???")); (p ? p->getIP() : std::string("???"));
Peer::punishPeer(peer, LT_InvalidSignature); Peer::punishPeer(peer, LT_InvalidSignature);
return; return;
@@ -947,7 +946,7 @@ static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packe
} }
else else
{ {
cLog(lsWARNING) << "Ledger proposal fails signature check"; // Could be mismatched prev ledger WriteLog (lsWARNING, Peer) << "Ledger proposal fails signature check"; // Could be mismatched prev ledger
proposal->setSignature(set.signature()); proposal->setSignature(set.signature());
} }
} }
@@ -960,14 +959,14 @@ static void checkPropose(Job& job, boost::shared_ptr<ripple::TMProposeSet> packe
} }
else if (sigGood && (prevLedger == consensusLCL)) else if (sigGood && (prevLedger == consensusLCL))
{ // relay untrusted proposal { // relay untrusted proposal
cLog(lsTRACE) << "relaying untrusted proposal"; WriteLog (lsTRACE, Peer) << "relaying untrusted proposal";
std::set<uint64> peers; std::set<uint64> peers;
theApp->getSuppression().swapSet(proposal->getSuppression(), peers, SF_RELAYED); theApp->getSuppression().swapSet(proposal->getSuppression(), peers, SF_RELAYED);
PackedMessage::pointer message = boost::make_shared<PackedMessage>(set, ripple::mtPROPOSE_LEDGER); PackedMessage::pointer message = boost::make_shared<PackedMessage>(set, ripple::mtPROPOSE_LEDGER);
theApp->getConnectionPool().relayMessageBut(peers, message); theApp->getConnectionPool().relayMessageBut(peers, message);
} }
else else
cLog(lsDEBUG) << "Not relaying untrusted proposal"; WriteLog (lsDEBUG, Peer) << "Not relaying untrusted proposal";
} }
void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet) void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet)
@@ -978,14 +977,14 @@ void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet)
if ((set.currenttxhash().size() != 32) || (set.nodepubkey().size() < 28) || if ((set.currenttxhash().size() != 32) || (set.nodepubkey().size() < 28) ||
(set.signature().size() < 56) || (set.nodepubkey().size() > 128) || (set.signature().size() > 128)) (set.signature().size() < 56) || (set.nodepubkey().size() > 128) || (set.signature().size() > 128))
{ {
cLog(lsWARNING) << "Received proposal is malformed"; WriteLog (lsWARNING, Peer) << "Received proposal is malformed";
punishPeer(LT_InvalidSignature); punishPeer(LT_InvalidSignature);
return; return;
} }
if (set.has_previousledger() && (set.previousledger().size() != 32)) if (set.has_previousledger() && (set.previousledger().size() != 32))
{ {
cLog(lsWARNING) << "Received proposal is malformed"; WriteLog (lsWARNING, Peer) << "Received proposal is malformed";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1007,18 +1006,18 @@ void Peer::recvPropose(const boost::shared_ptr<ripple::TMProposeSet>& packet)
if (!theApp->isNew(suppression, mPeerId)) if (!theApp->isNew(suppression, mPeerId))
{ {
cLog(lsTRACE) << "Received duplicate proposal from peer " << mPeerId; WriteLog (lsTRACE, Peer) << "Received duplicate proposal from peer " << mPeerId;
return; return;
} }
RippleAddress signerPublic = RippleAddress::createNodePublic(strCopy(set.nodepubkey())); RippleAddress signerPublic = RippleAddress::createNodePublic(strCopy(set.nodepubkey()));
if (signerPublic == theConfig.VALIDATION_PUB) if (signerPublic == theConfig.VALIDATION_PUB)
{ {
cLog(lsTRACE) << "Received our own proposal from peer " << mPeerId; WriteLog (lsTRACE, Peer) << "Received our own proposal from peer " << mPeerId;
return; return;
} }
bool isTrusted = theApp->getUNL().nodeInUNL(signerPublic); bool isTrusted = theApp->getUNL().nodeInUNL(signerPublic);
cLog(lsTRACE) << "Received " << (isTrusted ? "trusted" : "UNtrusted") << " proposal from " << mPeerId; WriteLog (lsTRACE, Peer) << "Received " << (isTrusted ? "trusted" : "UNtrusted") << " proposal from " << mPeerId;
uint256 consensusLCL = theApp->getOPs().getConsensusLCL(); uint256 consensusLCL = theApp->getOPs().getConsensusLCL();
LedgerProposal::pointer proposal = boost::make_shared<LedgerProposal>( LedgerProposal::pointer proposal = boost::make_shared<LedgerProposal>(
@@ -1055,7 +1054,7 @@ static void checkValidation(Job&, SerializedValidation::pointer val, uint256 sig
{ {
if (!isCluster && !val->isValid(signingHash)) if (!isCluster && !val->isValid(signingHash))
{ {
cLog(lsWARNING) << "Validation is invalid"; WriteLog (lsWARNING, Peer) << "Validation is invalid";
Peer::punishPeer(peer, LT_InvalidRequest); Peer::punishPeer(peer, LT_InvalidRequest);
return; return;
} }
@@ -1078,7 +1077,7 @@ static void checkValidation(Job&, SerializedValidation::pointer val, uint256 sig
#ifndef TRUST_NETWORK #ifndef TRUST_NETWORK
catch (...) catch (...)
{ {
cLog(lsWARNING) << "Exception processing validation"; WriteLog (lsWARNING, Peer) << "Exception processing validation";
Peer::punishPeer(peer, LT_InvalidRequest); Peer::punishPeer(peer, LT_InvalidRequest);
} }
#endif #endif
@@ -1089,7 +1088,7 @@ void Peer::recvValidation(const boost::shared_ptr<ripple::TMValidation>& packet,
MasterLockHolder.unlock(); MasterLockHolder.unlock();
if (packet->validation().size() < 50) if (packet->validation().size() < 50)
{ {
cLog(lsWARNING) << "Too small validation from peer"; WriteLog (lsWARNING, Peer) << "Too small validation from peer";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1105,7 +1104,7 @@ void Peer::recvValidation(const boost::shared_ptr<ripple::TMValidation>& packet,
uint256 signingHash = val->getSigningHash(); uint256 signingHash = val->getSigningHash();
if (!theApp->isNew(signingHash, mPeerId)) if (!theApp->isNew(signingHash, mPeerId))
{ {
cLog(lsTRACE) << "Validation is duplicate"; WriteLog (lsTRACE, Peer) << "Validation is duplicate";
return; return;
} }
@@ -1117,7 +1116,7 @@ void Peer::recvValidation(const boost::shared_ptr<ripple::TMValidation>& packet,
#ifndef TRUST_NETWORK #ifndef TRUST_NETWORK
catch (...) catch (...)
{ {
cLog(lsWARNING) << "Exception processing validation"; WriteLog (lsWARNING, Peer) << "Exception processing validation";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
} }
#endif #endif
@@ -1161,7 +1160,7 @@ void Peer::recvGetPeers(ripple::TMGetPeers& packet, ScopedLock& MasterLockHolder
addr->set_ipv4(inet_addr(strIP.c_str())); addr->set_ipv4(inet_addr(strIP.c_str()));
addr->set_ipv4port(iPort); addr->set_ipv4port(iPort);
//cLog(lsINFO) << "Peer: Teaching: " << ADDRESS(this) << ": " << n << ": " << strIP << " " << iPort; //WriteLog (lsINFO, Peer) << "Peer: Teaching: " << ADDRESS(this) << ": " << n << ": " << strIP << " " << iPort;
} }
PackedMessage::pointer message = boost::make_shared<PackedMessage>(peers, ripple::mtPEERS); PackedMessage::pointer message = boost::make_shared<PackedMessage>(peers, ripple::mtPEERS);
@@ -1183,7 +1182,7 @@ void Peer::recvPeers(ripple::TMPeers& packet)
if (strIP != "0.0.0.0" && strIP != "127.0.0.1") if (strIP != "0.0.0.0" && strIP != "127.0.0.1")
{ {
//cLog(lsINFO) << "Peer: Learning: " << ADDRESS(this) << ": " << i << ": " << strIP << " " << iPort; //WriteLog (lsINFO, Peer) << "Peer: Learning: " << ADDRESS(this) << ": " << i << ": " << strIP << " " << iPort;
theApp->getConnectionPool().savePeer(strIP, iPort, UniqueNodeList::vsTold); theApp->getConnectionPool().savePeer(strIP, iPort, UniqueNodeList::vsTold);
} }
@@ -1231,7 +1230,7 @@ void Peer::recvGetObjectByHash(const boost::shared_ptr<ripple::TMGetObjectByHash
} }
} }
} }
cLog(lsTRACE) << "GetObjByHash had " << reply.objects_size() << " of " << packet.objects_size() WriteLog (lsTRACE, Peer) << "GetObjByHash had " << reply.objects_size() << " of " << packet.objects_size()
<< " for " << getIP(); << " for " << getIP();
sendPacket(boost::make_shared<PackedMessage>(reply, ripple::mtGET_OBJECTS), true); sendPacket(boost::make_shared<PackedMessage>(reply, ripple::mtGET_OBJECTS), true);
} }
@@ -1250,12 +1249,12 @@ void Peer::recvGetObjectByHash(const boost::shared_ptr<ripple::TMGetObjectByHash
{ {
if (obj.ledgerseq() != pLSeq) if (obj.ledgerseq() != pLSeq)
{ {
tLog(pLDo && (pLSeq != 0), lsDEBUG) << "Recevied full fetch pack for " << pLSeq; CondLog (pLDo && (pLSeq != 0), lsDEBUG, Peer) << "Recevied full fetch pack for " << pLSeq;
pLSeq = obj.ledgerseq(); pLSeq = obj.ledgerseq();
pLDo = !theApp->getOPs().haveLedger(pLSeq); pLDo = !theApp->getOPs().haveLedger(pLSeq);
if (!pLDo) if (!pLDo)
{ {
cLog(lsDEBUG) << "Got pack for " << pLSeq << " too late"; WriteLog (lsDEBUG, Peer) << "Got pack for " << pLSeq << " too late";
} }
else else
progress = true; progress = true;
@@ -1274,7 +1273,7 @@ void Peer::recvGetObjectByHash(const boost::shared_ptr<ripple::TMGetObjectByHash
} }
} }
} }
tLog(pLDo && (pLSeq != 0), lsDEBUG) << "Received partial fetch pack for " << pLSeq; CondLog (pLDo && (pLSeq != 0), lsDEBUG, Peer) << "Received partial fetch pack for " << pLSeq;
if (packet.type() == ripple::TMGetObjectByHash::otFETCH_PACK) if (packet.type() == ripple::TMGetObjectByHash::otFETCH_PACK)
theApp->getOPs().gotFetchPack(progress, pLSeq); theApp->getOPs().gotFetchPack(progress, pLSeq);
} }
@@ -1365,12 +1364,12 @@ void Peer::recvProofWork(ripple::TMProofWork& packet)
return; return;
} }
cLog(lsINFO) << "Received in valid proof of work object from peer"; WriteLog (lsINFO, Peer) << "Received in valid proof of work object from peer";
} }
void Peer::recvStatus(ripple::TMStatusChange& packet) void Peer::recvStatus(ripple::TMStatusChange& packet)
{ {
cLog(lsTRACE) << "Received status change from peer " << getIP(); WriteLog (lsTRACE, Peer) << "Received status change from peer " << getIP();
if (!packet.has_networktime()) if (!packet.has_networktime())
packet.set_networktime(theApp->getOPs().getNetworkTimeNC()); packet.set_networktime(theApp->getOPs().getNetworkTimeNC());
@@ -1387,7 +1386,7 @@ void Peer::recvStatus(ripple::TMStatusChange& packet)
{ {
if (!mClosedLedgerHash.isZero()) if (!mClosedLedgerHash.isZero())
{ {
cLog(lsTRACE) << "peer has lost sync " << getIP(); WriteLog (lsTRACE, Peer) << "peer has lost sync " << getIP();
mClosedLedgerHash.zero(); mClosedLedgerHash.zero();
} }
mPreviousLedgerHash.zero(); mPreviousLedgerHash.zero();
@@ -1397,11 +1396,11 @@ void Peer::recvStatus(ripple::TMStatusChange& packet)
{ // a peer has changed ledgers { // a peer has changed ledgers
memcpy(mClosedLedgerHash.begin(), packet.ledgerhash().data(), 256 / 8); memcpy(mClosedLedgerHash.begin(), packet.ledgerhash().data(), 256 / 8);
addLedger(mClosedLedgerHash); addLedger(mClosedLedgerHash);
cLog(lsTRACE) << "peer LCL is " << mClosedLedgerHash << " " << getIP(); WriteLog (lsTRACE, Peer) << "peer LCL is " << mClosedLedgerHash << " " << getIP();
} }
else else
{ {
cLog(lsTRACE) << "peer has no ledger hash" << getIP(); WriteLog (lsTRACE, Peer) << "peer has no ledger hash" << getIP();
mClosedLedgerHash.zero(); mClosedLedgerHash.zero();
} }
@@ -1431,11 +1430,11 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
if (packet.itype() == ripple::liTS_CANDIDATE) if (packet.itype() == ripple::liTS_CANDIDATE)
{ // Request is for a transaction candidate set { // Request is for a transaction candidate set
cLog(lsDEBUG) << "Received request for TX candidate set data " << getIP(); WriteLog (lsDEBUG, Peer) << "Received request for TX candidate set data " << getIP();
if ((!packet.has_ledgerhash() || packet.ledgerhash().size() != 32)) if ((!packet.has_ledgerhash() || packet.ledgerhash().size() != 32))
{ {
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
cLog(lsWARNING) << "invalid request for TX candidate set data"; WriteLog (lsWARNING, Peer) << "invalid request for TX candidate set data";
return; return;
} }
uint256 txHash; uint256 txHash;
@@ -1445,7 +1444,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
{ {
if (packet.has_querytype() && !packet.has_requestcookie()) if (packet.has_querytype() && !packet.has_requestcookie())
{ {
cLog(lsDEBUG) << "Trying to route TX set request"; WriteLog (lsDEBUG, Peer) << "Trying to route TX set request";
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector(); std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
std::vector<Peer::pointer> usablePeers; std::vector<Peer::pointer> usablePeers;
BOOST_FOREACH(Peer::ref peer, peerList) BOOST_FOREACH(Peer::ref peer, peerList)
@@ -1455,7 +1454,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
} }
if (usablePeers.empty()) if (usablePeers.empty())
{ {
cLog(lsINFO) << "Unable to route TX set request"; WriteLog (lsINFO, Peer) << "Unable to route TX set request";
return; return;
} }
Peer::ref selectedPeer = usablePeers[rand() % usablePeers.size()]; Peer::ref selectedPeer = usablePeers[rand() % usablePeers.size()];
@@ -1463,7 +1462,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
selectedPeer->sendPacket(boost::make_shared<PackedMessage>(packet, ripple::mtGET_LEDGER), false); selectedPeer->sendPacket(boost::make_shared<PackedMessage>(packet, ripple::mtGET_LEDGER), false);
return; return;
} }
cLog(lsERROR) << "We do not have the map our peer wants " << getIP(); WriteLog (lsERROR, Peer) << "We do not have the map our peer wants " << getIP();
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1475,7 +1474,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
} }
else else
{ // Figure out what ledger they want { // Figure out what ledger they want
cLog(lsTRACE) << "Received request for ledger data " << getIP(); WriteLog (lsTRACE, Peer) << "Received request for ledger data " << getIP();
Ledger::pointer ledger; Ledger::pointer ledger;
if (packet.has_ledgerhash()) if (packet.has_ledgerhash())
{ {
@@ -1483,14 +1482,14 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
if (packet.ledgerhash().size() != 32) if (packet.ledgerhash().size() != 32)
{ {
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
cLog(lsWARNING) << "Invalid request"; WriteLog (lsWARNING, Peer) << "Invalid request";
return; return;
} }
memcpy(ledgerhash.begin(), packet.ledgerhash().data(), 32); memcpy(ledgerhash.begin(), packet.ledgerhash().data(), 32);
logMe += "LedgerHash:"; logMe += ledgerhash.GetHex(); logMe += "LedgerHash:"; logMe += ledgerhash.GetHex();
ledger = theApp->getLedgerMaster().getLedgerByHash(ledgerhash); ledger = theApp->getLedgerMaster().getLedgerByHash(ledgerhash);
tLog(!ledger, lsTRACE) << "Don't have ledger " << ledgerhash; CondLog (!ledger, lsTRACE, Peer) << "Don't have ledger " << ledgerhash;
if (!ledger && (packet.has_querytype() && !packet.has_requestcookie())) if (!ledger && (packet.has_querytype() && !packet.has_requestcookie()))
{ {
uint32 seq = 0; uint32 seq = 0;
@@ -1505,20 +1504,20 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
} }
if (usablePeers.empty()) if (usablePeers.empty())
{ {
cLog(lsTRACE) << "Unable to route ledger request"; WriteLog (lsTRACE, Peer) << "Unable to route ledger request";
return; return;
} }
Peer::ref selectedPeer = usablePeers[rand() % usablePeers.size()]; Peer::ref selectedPeer = usablePeers[rand() % usablePeers.size()];
packet.set_requestcookie(getPeerId()); packet.set_requestcookie(getPeerId());
selectedPeer->sendPacket(boost::make_shared<PackedMessage>(packet, ripple::mtGET_LEDGER), false); selectedPeer->sendPacket(boost::make_shared<PackedMessage>(packet, ripple::mtGET_LEDGER), false);
cLog(lsDEBUG) << "Ledger request routed"; WriteLog (lsDEBUG, Peer) << "Ledger request routed";
return; return;
} }
} }
else if (packet.has_ledgerseq()) else if (packet.has_ledgerseq())
{ {
ledger = theApp->getLedgerMaster().getLedgerBySeq(packet.ledgerseq()); ledger = theApp->getLedgerMaster().getLedgerBySeq(packet.ledgerseq());
tLog(!ledger, lsDEBUG) << "Don't have ledger " << packet.ledgerseq(); CondLog (!ledger, lsDEBUG, Peer) << "Don't have ledger " << packet.ledgerseq();
} }
else if (packet.has_ltype() && (packet.ltype() == ripple::ltCURRENT)) else if (packet.has_ltype() && (packet.ltype() == ripple::ltCURRENT))
ledger = theApp->getLedgerMaster().getCurrentLedger(); ledger = theApp->getLedgerMaster().getCurrentLedger();
@@ -1531,14 +1530,14 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
else else
{ {
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
cLog(lsWARNING) << "Can't figure out what ledger they want"; WriteLog (lsWARNING, Peer) << "Can't figure out what ledger they want";
return; return;
} }
if ((!ledger) || (packet.has_ledgerseq() && (packet.ledgerseq() != ledger->getLedgerSeq()))) if ((!ledger) || (packet.has_ledgerseq() && (packet.ledgerseq() != ledger->getLedgerSeq())))
{ {
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
if (sLog(lsWARNING)) if (ShouldLog (lsWARNING, Peer))
{ {
if (ledger) if (ledger)
Log(lsWARNING) << "Ledger has wrong sequence"; Log(lsWARNING) << "Ledger has wrong sequence";
@@ -1550,7 +1549,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
MasterLockHolder.unlock(); MasterLockHolder.unlock();
else else
{ {
cLog(lsWARNING) << "Request for data from mutable ledger"; WriteLog (lsWARNING, Peer) << "Request for data from mutable ledger";
} }
// Fill out the reply // Fill out the reply
@@ -1561,7 +1560,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
if(packet.itype() == ripple::liBASE) if(packet.itype() == ripple::liBASE)
{ // they want the ledger base data { // they want the ledger base data
cLog(lsTRACE) << "They want ledger base data"; WriteLog (lsTRACE, Peer) << "They want ledger base data";
Serializer nData(128); Serializer nData(128);
ledger->addRaw(nData); ledger->addRaw(nData);
reply.add_nodes()->set_nodedata(nData.getDataPtr(), nData.getLength()); reply.add_nodes()->set_nodedata(nData.getDataPtr(), nData.getLength());
@@ -1605,18 +1604,18 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
if ((!map) || (packet.nodeids_size() == 0)) if ((!map) || (packet.nodeids_size() == 0))
{ {
cLog(lsWARNING) << "Can't find map or empty request"; WriteLog (lsWARNING, Peer) << "Can't find map or empty request";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
cLog(lsTRACE) << "Request: " << logMe; WriteLog (lsTRACE, Peer) << "Request: " << logMe;
for(int i = 0; i < packet.nodeids().size(); ++i) for(int i = 0; i < packet.nodeids().size(); ++i)
{ {
SHAMapNode mn(packet.nodeids(i).data(), packet.nodeids(i).size()); SHAMapNode mn(packet.nodeids(i).data(), packet.nodeids(i).size());
if(!mn.isValid()) if(!mn.isValid())
{ {
cLog(lsWARNING) << "Request for invalid node: " << logMe; WriteLog (lsWARNING, Peer) << "Request for invalid node: " << logMe;
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1627,7 +1626,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
if(map->getNodeFat(mn, nodeIDs, rawNodes, fatRoot, fatLeaves)) if(map->getNodeFat(mn, nodeIDs, rawNodes, fatRoot, fatLeaves))
{ {
assert(nodeIDs.size() == rawNodes.size()); assert(nodeIDs.size() == rawNodes.size());
cLog(lsTRACE) << "getNodeFat got " << rawNodes.size() << " nodes"; WriteLog (lsTRACE, Peer) << "getNodeFat got " << rawNodes.size() << " nodes";
std::vector<SHAMapNode>::iterator nodeIDIterator; std::vector<SHAMapNode>::iterator nodeIDIterator;
std::list< std::vector<unsigned char> >::iterator rawNodeIterator; std::list< std::vector<unsigned char> >::iterator rawNodeIterator;
for(nodeIDIterator = nodeIDs.begin(), rawNodeIterator = rawNodes.begin(); for(nodeIDIterator = nodeIDs.begin(), rawNodeIterator = rawNodes.begin();
@@ -1641,7 +1640,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
} }
} }
else else
cLog(lsWARNING) << "getNodeFat returns false"; WriteLog (lsWARNING, Peer) << "getNodeFat returns false";
} }
catch (std::exception& e) catch (std::exception& e)
{ {
@@ -1658,7 +1657,7 @@ void Peer::recvGetLedger(ripple::TMGetLedger& packet, ScopedLock& MasterLockHold
if (!packet.has_ledgerhash()) if (!packet.has_ledgerhash())
info += ", no hash specified"; info += ", no hash specified";
cLog(lsWARNING) << "getNodeFat( " << mn <<") throws exception: " << info; WriteLog (lsWARNING, Peer) << "getNodeFat( " << mn <<") throws exception: " << info;
} }
} }
PackedMessage::pointer oPacket = boost::make_shared<PackedMessage>(reply, ripple::mtLEDGER_DATA); PackedMessage::pointer oPacket = boost::make_shared<PackedMessage>(reply, ripple::mtLEDGER_DATA);
@@ -1671,7 +1670,7 @@ void Peer::recvLedger(const boost::shared_ptr<ripple::TMLedgerData>& packet_ptr,
ripple::TMLedgerData& packet = *packet_ptr; ripple::TMLedgerData& packet = *packet_ptr;
if (packet.nodes().size() <= 0) if (packet.nodes().size() <= 0)
{ {
cLog(lsWARNING) << "Ledger/TXset data with no nodes"; WriteLog (lsWARNING, Peer) << "Ledger/TXset data with no nodes";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1686,7 +1685,7 @@ void Peer::recvLedger(const boost::shared_ptr<ripple::TMLedgerData>& packet_ptr,
} }
else else
{ {
cLog(lsINFO) << "Unable to route TX/ledger data reply"; WriteLog (lsINFO, Peer) << "Unable to route TX/ledger data reply";
punishPeer(LT_UnwantedData); punishPeer(LT_UnwantedData);
} }
return; return;
@@ -1695,7 +1694,7 @@ void Peer::recvLedger(const boost::shared_ptr<ripple::TMLedgerData>& packet_ptr,
uint256 hash; uint256 hash;
if(packet.ledgerhash().size() != 32) if(packet.ledgerhash().size() != 32)
{ {
cLog(lsWARNING) << "TX candidate reply with invalid hash size"; WriteLog (lsWARNING, Peer) << "TX candidate reply with invalid hash size";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1711,7 +1710,7 @@ void Peer::recvLedger(const boost::shared_ptr<ripple::TMLedgerData>& packet_ptr,
const ripple::TMLedgerNode& node = packet.nodes(i); const ripple::TMLedgerNode& node = packet.nodes(i);
if (!node.has_nodeid() || !node.has_nodedata() || (node.nodeid().size() != 33)) if (!node.has_nodeid() || !node.has_nodedata() || (node.nodeid().size() != 33))
{ {
cLog(lsWARNING) << "LedgerData request with invalid node ID"; WriteLog (lsWARNING, Peer) << "LedgerData request with invalid node ID";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1862,7 +1861,7 @@ void Peer::doProofOfWork(Job&, boost::weak_ptr<Peer> peer, ProofOfWork::pointer
uint256 solution = pow->solve(); uint256 solution = pow->solve();
if (solution.isZero()) if (solution.isZero())
{ {
cLog(lsWARNING) << "Failed to solve proof of work"; WriteLog (lsWARNING, Peer) << "Failed to solve proof of work";
} }
else else
{ {
@@ -1885,12 +1884,12 @@ void Peer::doFetchPack(const boost::shared_ptr<ripple::TMGetObjectByHash>& packe
{ {
if (theApp->getFeeTrack().isLoaded()) if (theApp->getFeeTrack().isLoaded())
{ {
cLog(lsINFO) << "Too busy to make fetch pack"; WriteLog (lsINFO, Peer) << "Too busy to make fetch pack";
return; return;
} }
if (packet->ledgerhash().size() != 32) if (packet->ledgerhash().size() != 32)
{ {
cLog(lsWARNING) << "FetchPack hash size malformed"; WriteLog (lsWARNING, Peer) << "FetchPack hash size malformed";
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1900,13 +1899,13 @@ void Peer::doFetchPack(const boost::shared_ptr<ripple::TMGetObjectByHash>& packe
Ledger::pointer haveLedger = theApp->getOPs().getLedgerByHash(hash); Ledger::pointer haveLedger = theApp->getOPs().getLedgerByHash(hash);
if (!haveLedger) if (!haveLedger)
{ {
cLog(lsINFO) << "Peer requests fetch pack for ledger we don't have: " << hash; WriteLog (lsINFO, Peer) << "Peer requests fetch pack for ledger we don't have: " << hash;
punishPeer(LT_RequestNoReply); punishPeer(LT_RequestNoReply);
return; return;
} }
if (!haveLedger->isClosed()) if (!haveLedger->isClosed())
{ {
cLog(lsWARNING) << "Peer requests fetch pack from open ledger: " << hash; WriteLog (lsWARNING, Peer) << "Peer requests fetch pack from open ledger: " << hash;
punishPeer(LT_InvalidRequest); punishPeer(LT_InvalidRequest);
return; return;
} }
@@ -1914,7 +1913,7 @@ void Peer::doFetchPack(const boost::shared_ptr<ripple::TMGetObjectByHash>& packe
Ledger::pointer wantLedger = theApp->getOPs().getLedgerByHash(haveLedger->getParentHash()); Ledger::pointer wantLedger = theApp->getOPs().getLedgerByHash(haveLedger->getParentHash());
if (!wantLedger) if (!wantLedger)
{ {
cLog(lsINFO) << "Peer requests fetch pack for ledger whose predecessor we don't have: " << hash; WriteLog (lsINFO, Peer) << "Peer requests fetch pack for ledger whose predecessor we don't have: " << hash;
punishPeer(LT_RequestNoReply); punishPeer(LT_RequestNoReply);
return; return;
} }
@@ -1966,7 +1965,7 @@ Json::Value Peer::getJson()
case ripple::nsMONITORING: ret["status"] = "monitoring"; break; case ripple::nsMONITORING: ret["status"] = "monitoring"; break;
case ripple::nsVALIDATING: ret["status"] = "validating"; break; case ripple::nsVALIDATING: ret["status"] = "validating"; break;
case ripple::nsSHUTTING: ret["status"] = "shutting"; break; case ripple::nsSHUTTING: ret["status"] = "shutting"; break;
default: cLog(lsWARNING) << "Peer has unknown status: " << mLastStatus.newstatus(); default: WriteLog (lsWARNING, Peer) << "Peer has unknown status: " << mLastStatus.newstatus();
} }
} }

View File

@@ -11,17 +11,9 @@
#include "utils.h" #include "utils.h"
#include "Log.h" #include "Log.h"
SETUP_LOG();
using namespace std; using namespace std;
using namespace boost::asio::ip; using namespace boost::asio::ip;
// Generate DH for SSL connection.
static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
{
return 512 == iKeyLength ? theApp->getWallet().getDh512() : theApp->getWallet().getDh1024();
}
PeerDoor::PeerDoor(boost::asio::io_service& io_service) : PeerDoor::PeerDoor(boost::asio::io_service& io_service) :
mAcceptor(io_service, mAcceptor(io_service,
tcp::endpoint(address().from_string(theConfig.PEER_IP.empty() ? "0.0.0.0" : theConfig.PEER_IP), tcp::endpoint(address().from_string(theConfig.PEER_IP.empty() ? "0.0.0.0" : theConfig.PEER_IP),
@@ -67,7 +59,7 @@ void PeerDoor::handleConnect(Peer::pointer new_connection,
{ {
if (error == boost::system::errc::too_many_files_open) if (error == boost::system::errc::too_many_files_open)
delay = true; delay = true;
cLog(lsERROR) << error; WriteLog (lsERROR, PeerDoor) << error;
} }
if (delay) if (delay)

View File

@@ -64,7 +64,7 @@ public:
mLoadSource(mRemoteIP), mPingTimer(cpConnection->get_io_service()), mPinged(false), mLoadSource(mRemoteIP), mPingTimer(cpConnection->get_io_service()), mPinged(false),
mRcvQueueRunning(false), mDead(false) mRcvQueueRunning(false), mDead(false)
{ {
cLog(lsDEBUG) << "Websocket connection from " << mRemoteIP; WriteLog (lsDEBUG, WSServerHandlerLog) << "Websocket connection from " << mRemoteIP;
setPingTimer(); setPingTimer();
} }

View File

@@ -1,11 +1,9 @@
#include "Log.h" #include "Log.h"
#define WSDOOR_CPP //#define WSDOOR_CPP
#include "../websocketpp/src/sockets/autotls.hpp" //#include "../websocketpp/src/sockets/autotls.hpp"
#include "../websocketpp/src/websocketpp.hpp" //#include "../websocketpp/src/websocketpp.hpp"
SETUP_LOG();
#include "Application.h" #include "Application.h"
#include "Config.h" #include "Config.h"
@@ -40,12 +38,6 @@ DECLARE_INSTANCE(WebSocketConnection);
// - NetworkOPs is smart enough to subscribe and or pass back messages // - NetworkOPs is smart enough to subscribe and or pass back messages
// //
// Generate DH for SSL connection.
static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
{
return 512 == iKeyLength ? theApp->getWallet().getDh512() : theApp->getWallet().getDh1024();
}
void WSDoor::startListening() void WSDoor::startListening()
{ {
NameThread("websocket"); NameThread("websocket");
@@ -78,7 +70,7 @@ void WSDoor::startListening()
} }
catch (websocketpp::exception& e) catch (websocketpp::exception& e)
{ {
cLog(lsWARNING) << "websocketpp exception: " << e.what(); WriteLog (lsWARNING, WSDoor) << "websocketpp exception: " << e.what();
while (1) // temporary workaround for websocketpp throwing exceptions on access/close races while (1) // temporary workaround for websocketpp throwing exceptions on access/close races
{ // https://github.com/zaphoyd/websocketpp/issues/98 { // https://github.com/zaphoyd/websocketpp/issues/98
try try
@@ -88,7 +80,7 @@ void WSDoor::startListening()
} }
catch (websocketpp::exception& e) catch (websocketpp::exception& e)
{ {
cLog(lsWARNING) << "websocketpp exception: " << e.what(); WriteLog (lsWARNING, WSDoor) << "websocketpp exception: " << e.what();
} }
} }
} }
@@ -100,7 +92,7 @@ WSDoor* WSDoor::createWSDoor(const std::string& strIp, const int iPort, bool bPu
{ {
WSDoor* wdpResult = new WSDoor(strIp, iPort, bPublic); WSDoor* wdpResult = new WSDoor(strIp, iPort, bPublic);
cLog(lsINFO) << WriteLog (lsINFO, WSDoor) <<
boost::str(boost::format("Websocket: %s: Listening: %s %d ") boost::str(boost::format("Websocket: %s: Listening: %s %d ")
% (bPublic ? "Public" : "Private") % (bPublic ? "Public" : "Private")
% strIp % strIp

View File

@@ -7,6 +7,10 @@
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include "../websocketpp/src/sockets/autotls.hpp"
#include "../websocketpp/src/websocketpp.hpp"
/*
#ifndef WSDOOR_CPP #ifndef WSDOOR_CPP
namespace websocketpp namespace websocketpp
@@ -16,6 +20,7 @@ namespace websocketpp
} }
#endif #endif
*/
class WSDoor class WSDoor
{ {

View File

@@ -13,8 +13,13 @@ class WSConnection;
// CAUTION: on_* functions are called by the websocket code while holding a lock // CAUTION: on_* functions are called by the websocket code while holding a lock
struct WSServerHandlerLog // for logging
{
};
// A single instance of this object is made. // A single instance of this object is made.
// This instance dispatches all events. There is no per connection persistence. // This instance dispatches all events. There is no per connection persistence.
template <typename endpoint_type> template <typename endpoint_type>
class WSServerHandler : public endpoint_type::handler class WSServerHandler : public endpoint_type::handler
{ {
@@ -65,7 +70,7 @@ public:
{ {
try try
{ {
cLog(broadcast ? lsTRACE : lsDEBUG) << "Ws:: Sending '" << strMessage << "'"; WriteLog (broadcast ? lsTRACE : lsDEBUG, WSServerHandlerLog) << "Ws:: Sending '" << strMessage << "'";
cpClient->send(strMessage); cpClient->send(strMessage);
} }
@@ -91,7 +96,7 @@ public:
{ {
Json::FastWriter jfwWriter; Json::FastWriter jfwWriter;
// cLog(lsDEBUG) << "Ws:: Object '" << jfwWriter.write(jvObj) << "'"; // WriteLog (lsDEBUG, WSServerHandlerLog) << "Ws:: Object '" << jfwWriter.write(jvObj) << "'";
send(cpClient, jfwWriter.write(jvObj), broadcast); send(cpClient, jfwWriter.write(jvObj), broadcast);
} }
@@ -109,7 +114,7 @@ public:
std::string data("ping"); std::string data("ping");
if (ptr->onPingTimer(data)) if (ptr->onPingTimer(data))
{ {
cLog(lsWARNING) << "Connection pings out"; WriteLog (lsWARNING, WSServerHandlerLog) << "Connection pings out";
cpClient->close(websocketpp::close::status::PROTOCOL_ERROR, "ping timeout"); cpClient->close(websocketpp::close::status::PROTOCOL_ERROR, "ping timeout");
} }
else else
@@ -185,7 +190,7 @@ public:
{ {
try try
{ {
cLog(lsDEBUG) << "Ws:: Rejected(" WriteLog (lsDEBUG, WSServerHandlerLog) << "Ws:: Rejected("
<< cpClient->get_socket().lowest_layer().remote_endpoint().address().to_string() << cpClient->get_socket().lowest_layer().remote_endpoint().address().to_string()
<< ") '" << mpMessage->get_payload() << "'"; << ") '" << mpMessage->get_payload() << "'";
} }
@@ -227,7 +232,7 @@ public:
try try
{ {
cLog(lsDEBUG) << "Ws:: Receiving(" WriteLog (lsDEBUG, WSServerHandlerLog) << "Ws:: Receiving("
<< cpClient->get_socket().lowest_layer().remote_endpoint().address().to_string() << cpClient->get_socket().lowest_layer().remote_endpoint().address().to_string()
<< ") '" << mpMessage->get_payload() << "'"; << ") '" << mpMessage->get_payload() << "'";
} }