Pathfinding cleanup

This commit is contained in:
Miguel Portilla
2016-03-03 17:24:42 -05:00
committed by seelabs
parent 122a5cdf89
commit 48d28826d0
5 changed files with 115 additions and 119 deletions

View File

@@ -296,17 +296,19 @@ ServerHandlerImp::processRequest (Port const& port,
}
Resource::Consumer usage;
if (isUnlimited (role))
usage = m_resourceManager.newUnlimitedEndpoint (
remoteIPAddress.to_string());
else
usage = m_resourceManager.newInboundEndpoint(remoteIPAddress);
if (usage.disconnect ())
if (isUnlimited(role))
{
HTTPReply (503, "Server is overloaded", output, rpcJ);
return;
usage = m_resourceManager.newUnlimitedEndpoint(
remoteIPAddress.to_string());
}
else
{
usage = m_resourceManager.newInboundEndpoint(remoteIPAddress);
if (usage.disconnect())
{
HTTPReply(503, "Server is overloaded", output, rpcJ);
return;
}
}
std::string strMethod = method.asString ();
@@ -353,8 +355,6 @@ ServerHandlerImp::processRequest (Port const& port,
return;
}
Resource::Charge loadType = Resource::feeReferenceRPC;
JLOG(m_journal.debug) << "Query: " << strMethod << params;
// Provide the JSON-RPC method as the field "command" in the request.
@@ -362,6 +362,7 @@ ServerHandlerImp::processRequest (Port const& port,
JLOG (m_journal.trace)
<< "doRpcCommand:" << strMethod << ":" << params;
Resource::Charge loadType = Resource::feeReferenceRPC;
auto const start (std::chrono::high_resolution_clock::now ());
RPC::Context context {m_journal, params, app_, loadType, m_networkOPs,