Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/server.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | // safely removed once global variable usage has been eliminated. | ||||
} | } | ||||
} | } | ||||
std::string commandName = request.strMethod; | std::string commandName = request.strMethod; | ||||
{ | { | ||||
auto commandsReadView = commands.getReadView(); | auto commandsReadView = commands.getReadView(); | ||||
auto iter = commandsReadView->find(commandName); | auto iter = commandsReadView->find(commandName); | ||||
if (iter != commandsReadView.end()) { | if (iter != commandsReadView.end()) { | ||||
return iter->second.get()->Execute(request.params); | return iter->second.get()->Execute(request); | ||||
} | } | ||||
} | } | ||||
// TODO Remove the below call to tableRPC.execute() and only call it for | // TODO Remove the below call to tableRPC.execute() and only call it for | ||||
// context-free RPC commands via an implementation of RPCCommand. | // context-free RPC commands via an implementation of RPCCommand. | ||||
// Check if context-free RPC method is valid and execute it | // Check if context-free RPC method is valid and execute it | ||||
return tableRPC.execute(config, request); | return tableRPC.execute(config, request); | ||||
} | } | ||||
void RPCServer::RegisterCommand(std::unique_ptr<RPCCommand> command) { | void RPCServer::RegisterCommand( | ||||
std::unique_ptr<RPCCommandWithRequestContext> command) { | |||||
deadalnix: Another thing that the code is telling us is that the RPCServer is dealing with only one kind… | |||||
if (command != nullptr) { | if (command != nullptr) { | ||||
const std::string &commandName = command->GetName(); | const std::string &commandName = command->GetName(); | ||||
commands.getWriteView()->insert( | commands.getWriteView()->insert( | ||||
std::make_pair(commandName, std::move(command))); | std::make_pair(commandName, std::move(command))); | ||||
} | } | ||||
} | } | ||||
static struct CRPCSignals { | static struct CRPCSignals { | ||||
▲ Show 20 Lines • Show All 534 Lines • Show Last 20 Lines |
Another thing that the code is telling us is that the RPCServer is dealing with only one kind of command. It is therefore likely not a special kind of command.