Rename DebuggerProxy::send, DebuggerClient::send and DebuggerClient::recv
I found myself getting confused, thinking that proxy->send(cmd) sends a command to the proxy, when in fact it causes the proxy to send the command to the client. These are now named sendToClient, sendToServer and recvFromServer so that future readers (including my future self) will not make this mistake again.
Esse commit está contido em:
@@ -452,7 +452,7 @@ bool CmdBreak::onServer(DebuggerProxy *proxy) {
|
||||
if (m_body == "update") {
|
||||
proxy->setBreakPoints(m_bps);
|
||||
m_breakpoints = &m_bps;
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ bool CmdConstant::onServer(DebuggerProxy *proxy) {
|
||||
try {
|
||||
m_constants = ClassInfo::GetConstants();
|
||||
} catch (...) {}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -38,8 +38,8 @@ bool CmdEval::onClient(DebuggerClient *client) {
|
||||
m_body = client->getCode();
|
||||
m_frame = client->getFrame();
|
||||
m_bypassAccessCheck = client->getDebuggerBypassCheck();
|
||||
client->send(this);
|
||||
DebuggerCommandPtr res = client->recv(m_type);
|
||||
client->sendToServer(this);
|
||||
DebuggerCommandPtr res = client->recvFromServer(m_type);
|
||||
if (!res->is(m_type)) {
|
||||
assert(client->isApiMode());
|
||||
m_incomplete = true;
|
||||
@@ -66,7 +66,7 @@ bool CmdEval::onServer(DebuggerProxy *proxy) {
|
||||
g_context->setDebuggerBypassCheck(m_bypassAccessCheck);
|
||||
DebuggerProxy::ExecutePHP(m_body, m_output, !proxy->isLocal(), m_frame);
|
||||
g_context->setDebuggerBypassCheck(false);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
bool CmdEval::onServerVM(DebuggerProxy *proxy) {
|
||||
@@ -77,7 +77,7 @@ bool CmdEval::onServerVM(DebuggerProxy *proxy) {
|
||||
g_vmContext->setDebuggerBypassCheck(false);
|
||||
delete g_vmContext->m_lastLocFilter;
|
||||
g_vmContext->m_lastLocFilter = locSave;
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -67,7 +67,7 @@ bool CmdExample::onClient(DebuggerClient *client) {
|
||||
|
||||
bool CmdExample::onServer(DebuggerProxy *proxy) {
|
||||
m_output = m_input.size();
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -122,7 +122,7 @@ bool CmdExtension::processList(DebuggerProxy *proxy) {
|
||||
for (int i = 0; i < hrLen; i++) sb.append(BOX_H); sb.append("\n");
|
||||
|
||||
m_out = sb.detach();
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
bool CmdExtension::onServer(DebuggerProxy *proxy) {
|
||||
@@ -165,7 +165,7 @@ bool CmdExtension::onServer(DebuggerProxy *proxy) {
|
||||
m_err = "Unable to find the specified extension: ";
|
||||
m_err += String(name);
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -54,7 +54,7 @@ bool CmdFlowControl::onClient(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
m_smallStep = client->getDebuggerSmallStep();
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
throw DebuggerConsoleExitException();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void CmdGlobal::setClientOutput(DebuggerClient *client) {
|
||||
|
||||
bool CmdGlobal::onServer(DebuggerProxy *proxy) {
|
||||
m_globals = CmdVariable::GetGlobalVariables();
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -227,7 +227,7 @@ bool CmdInfo::onServer(DebuggerProxy *proxy) {
|
||||
vars.push_back("$" + iter.first().toString()->toCPPString());
|
||||
}
|
||||
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
if (m_type == KindOfUnknown || m_type == KindOfClass) {
|
||||
@@ -246,7 +246,7 @@ bool CmdInfo::onServer(DebuggerProxy *proxy) {
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -140,7 +140,7 @@ bool CmdInstrument::onServerVM(DebuggerProxy *proxy) {
|
||||
} else if (m_type == ActionWrite) {
|
||||
validateAndWriteToTable(proxyVM);
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
void CmdInstrument::readFromTable(DebuggerProxyVM *proxy) {
|
||||
|
||||
@@ -278,7 +278,7 @@ void CmdInterrupt::setClientOutput(DebuggerClient *client) {
|
||||
}
|
||||
|
||||
bool CmdInterrupt::onServer(DebuggerProxy *proxy) {
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
bool CmdInterrupt::shouldBreak(const BreakPointInfoPtrVec &bps) {
|
||||
|
||||
@@ -91,7 +91,7 @@ bool CmdJump::onClient(DebuggerClient *client) {
|
||||
}
|
||||
}
|
||||
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
throw DebuggerConsoleExitException();
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ bool CmdList::onServer(DebuggerProxy *proxy) {
|
||||
m_code = f_file_get_contents(full_path.c_str());
|
||||
}
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
Variant CmdList::GetSourceFile(DebuggerClient *client,
|
||||
|
||||
@@ -295,11 +295,11 @@ bool CmdMachine::onServer(DebuggerProxy *proxy) {
|
||||
LibEventHttpClient::SetCache(host.data(), port, 1);
|
||||
register_intercept("", "fb_rpc_intercept_handler", m_rpcConfig);
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
if (m_body == "list") {
|
||||
Debugger::GetRegisteredSandboxes(m_sandboxes);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
if (m_body == "attach" && !m_sandboxes.empty()) {
|
||||
m_succeed = proxy->switchSandbox(m_sandboxes[0]->id(), m_force);
|
||||
@@ -307,7 +307,7 @@ bool CmdMachine::onServer(DebuggerProxy *proxy) {
|
||||
proxy->notifyDummySandbox();
|
||||
m_exitInterrupt = true;
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ bool CmdPrint::onServer(DebuggerProxy *proxy) {
|
||||
m_ret = DebuggerProxy::ExecutePHP(DebuggerProxy::MakePHPReturn(m_body),
|
||||
m_output, !proxy->isLocal(), m_frame);
|
||||
g_context->setDebuggerBypassCheck(false);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
bool CmdPrint::onServerVM(DebuggerProxy *proxy) {
|
||||
@@ -385,7 +385,7 @@ bool CmdPrint::onServerVM(DebuggerProxy *proxy) {
|
||||
g_vmContext->setDebuggerBypassCheck(false);
|
||||
delete g_vmContext->m_lastLocFilter;
|
||||
g_vmContext->m_lastLocFilter = locSave;
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -35,7 +35,7 @@ bool CmdQuit::onClient(DebuggerClient *client) {
|
||||
if (DebuggerCommand::onClient(client)) return true;
|
||||
|
||||
if (client->argCount() == 0) {
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
client->quit();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool CmdRun::onClient(DebuggerClient *client) {
|
||||
|
||||
m_args = StringVecPtr(client->args(), null_deleter());
|
||||
m_smallStep = client->getDebuggerSmallStep();
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
client->clearCachedLocal();
|
||||
client->setFrame(0);
|
||||
throw DebuggerConsoleExitException();
|
||||
|
||||
@@ -69,7 +69,7 @@ bool CmdShell::onServer(DebuggerProxy *proxy) {
|
||||
argv[m_args.size()] = nullptr;
|
||||
Process::Exec(argv[0], argv, nullptr, m_out, &m_out, true);
|
||||
free(argv);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -31,12 +31,12 @@ void CmdSignal::recvImpl(DebuggerThriftBuffer &thrift) {
|
||||
|
||||
bool CmdSignal::onClient(DebuggerClient *client) {
|
||||
m_signum = client->pollSignal();
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmdSignal::onServer(DebuggerProxy *proxy) {
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -113,18 +113,18 @@ bool CmdThread::onClient(DebuggerClient *client) {
|
||||
processList(client);
|
||||
} else if (client->arg(1, "normal")) {
|
||||
m_body = "normal";
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
client->info("Thread is running in normal mode now. Other threads will "
|
||||
"interleave when they hit breakpoints as well.");
|
||||
} else if (client->arg(1, "sticky")) {
|
||||
m_body = "sticky";
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
client->info("Thread is running in sticky mode now. All other threads "
|
||||
"will wait until this thread finishes, when they hit "
|
||||
"breakpoints.");
|
||||
} else if (client->arg(1, "exclusive")) {
|
||||
m_body = "exclusive";
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
client->info("Thread is running in exclusive mode now. All other threads "
|
||||
"will not break, even when they hit breakpoints.");
|
||||
} else {
|
||||
@@ -160,7 +160,7 @@ bool CmdThread::onClient(DebuggerClient *client) {
|
||||
|
||||
m_body = "switch";
|
||||
m_threads.push_back(thread);
|
||||
client->send(this);
|
||||
client->sendToServer(this);
|
||||
throw DebuggerConsoleExitException();
|
||||
}
|
||||
|
||||
@@ -189,12 +189,12 @@ bool CmdThread::onServer(DebuggerProxy *proxy) {
|
||||
g_context->debuggerInfo(info);
|
||||
|
||||
m_out = DebuggerClient::FormatInfoVec(info);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
if (m_body == "list") {
|
||||
proxy->getThreads(m_threads);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
if (m_body == "switch") {
|
||||
if (!m_threads.empty()) {
|
||||
|
||||
@@ -154,7 +154,7 @@ Array CmdVariable::GetGlobalVariables() {
|
||||
|
||||
bool CmdVariable::onServerVM(DebuggerProxy *proxy) {
|
||||
m_variables = g_vmContext->getLocalDefinedVariables(m_frame);
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -162,7 +162,7 @@ bool CmdWhere::onServerVM(DebuggerProxy *proxy) {
|
||||
if (!m_stackArgs) {
|
||||
processStackTrace();
|
||||
}
|
||||
return proxy->send(this);
|
||||
return proxy->sendToClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1787,20 +1787,20 @@ std::string DebuggerClient::lineRest(int index) {
|
||||
|
||||
DebuggerCommandPtr DebuggerClient::xend(DebuggerCommand *cmd) {
|
||||
TRACE(2, "DebuggerClient::xend\n");
|
||||
send(cmd);
|
||||
return recv(cmd->getType());
|
||||
sendToServer(cmd);
|
||||
return recvFromServer(cmd->getType());
|
||||
}
|
||||
|
||||
void DebuggerClient::send(DebuggerCommand *cmd) {
|
||||
TRACE(2, "DebuggerClient::send\n");
|
||||
void DebuggerClient::sendToServer(DebuggerCommand *cmd) {
|
||||
TRACE(2, "DebuggerClient::sendToServer\n");
|
||||
if (!cmd->send(m_machine->m_thrift)) {
|
||||
throw DebuggerProtocolException();
|
||||
}
|
||||
}
|
||||
|
||||
DebuggerCommandPtr DebuggerClient::recv(int expected) {
|
||||
TRACE(2, "DebuggerClient::recv\n");
|
||||
const char *func = "DebuggerClient::recv()";
|
||||
DebuggerCommandPtr DebuggerClient::recvFromServer(int expected) {
|
||||
TRACE(2, "DebuggerClient::recvFromServer\n");
|
||||
const char *func = "DebuggerClient::recvFromServer ()";
|
||||
|
||||
DebuggerCommandPtr res;
|
||||
while (true) {
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
static String FormatTitle(const char *title);
|
||||
|
||||
public:
|
||||
DebuggerClient(std::string name = ""); // name only for api usage
|
||||
explicit DebuggerClient(std::string name = ""); // name only for api usage
|
||||
~DebuggerClient();
|
||||
void reset();
|
||||
|
||||
@@ -184,13 +184,15 @@ public:
|
||||
StringVec *args() { return &m_args;}
|
||||
|
||||
/**
|
||||
* Send the commmand to DebuggerProxy and expect same type of command back.
|
||||
* Send the commmand to server's DebuggerProxy
|
||||
* and expect same type of command back.
|
||||
*/
|
||||
template<typename T> boost::shared_ptr<T> xend(DebuggerCommand *cmd) {
|
||||
return boost::static_pointer_cast<T>(xend(cmd));
|
||||
}
|
||||
void send(DebuggerCommand *cmd);
|
||||
DebuggerCommandPtr recv(int expected);
|
||||
|
||||
void sendToServer(DebuggerCommand *cmd);
|
||||
DebuggerCommandPtr recvFromServer(int expected);
|
||||
|
||||
/**
|
||||
* Machine functions. True if we're switching to a machine that's not
|
||||
|
||||
@@ -277,8 +277,8 @@ void DebuggerProxy::interrupt(CmdInterrupt &cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
bool DebuggerProxy::send(DebuggerCommand *cmd) {
|
||||
TRACE(2, "DebuggerProxy::send\n");
|
||||
bool DebuggerProxy::sendToClient(DebuggerCommand *cmd) {
|
||||
TRACE(2, "DebuggerProxy::sendToClient\n");
|
||||
return cmd->send(m_thrift);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
bool needInterrupt();
|
||||
bool needInterruptForNonBreak();
|
||||
virtual void interrupt(CmdInterrupt &cmd);
|
||||
bool send(DebuggerCommand *cmd);
|
||||
bool sendToClient(DebuggerCommand *cmd);
|
||||
|
||||
void startSignalThread();
|
||||
void pollSignal(); // for signal polling thread
|
||||
|
||||
@@ -172,7 +172,7 @@ bool c_DebuggerProxyCmdUser::t_islocal() {
|
||||
|
||||
Variant c_DebuggerProxyCmdUser::t_send(CObjRef cmd) {
|
||||
CmdUser cmdUser(cmd);
|
||||
return m_proxy->send(&cmdUser);
|
||||
return m_proxy->sendToClient(&cmdUser);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -307,7 +307,7 @@ Array c_DebuggerClientCmdUser::t_args() {
|
||||
|
||||
Variant c_DebuggerClientCmdUser::t_send(CObjRef cmd) {
|
||||
CmdUser cmdUser(cmd);
|
||||
m_client->send(&cmdUser);
|
||||
m_client->sendToServer(&cmdUser);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário