Rename bind argument proto -> plugin to avoid confusion.

develop
Ben Lubar 2018-07-03 16:00:48 -05:00
parent 4a0682133e
commit dabe04cbf1
No known key found for this signature in database
GPG Key ID: 018BAB45DB2D2B24
2 changed files with 23 additions and 23 deletions

@ -236,7 +236,7 @@ void RemoteClient::disconnect()
}
bool RemoteClient::bind(color_ostream &out, RemoteFunctionBase *function,
const std::string &name, const std::string &proto)
const std::string &name, const std::string &plugin)
{
if (!active || !socket->IsSocketValid())
return false;
@ -247,8 +247,8 @@ bool RemoteClient::bind(color_ostream &out, RemoteFunctionBase *function,
auto in = bind_call.in();
in->set_method(name);
if (!proto.empty())
in->set_plugin(proto);
if (!plugin.empty())
in->set_plugin(plugin);
in->set_input_msg(function->p_in_template->GetTypeName());
in->set_output_msg(function->p_out_template->GetTypeName());
}
@ -326,23 +326,23 @@ void RPCFunctionBase::reset(bool free)
}
bool RemoteFunctionBase::bind(color_ostream &out, RemoteClient *client,
const std::string &name, const std::string &proto)
const std::string &name, const std::string &plugin)
{
if (isValid())
{
if (p_client == client && this->name == name && this->proto == proto)
if (p_client == client && this->name == name && this->plugin == plugin)
return true;
out.printerr("Function already bound to %s::%s\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
return false;
}
this->name = name;
this->proto = proto;
this->plugin = plugin;
this->p_client = client;
return client->bind(out, this, name, proto);
return client->bind(out, this, name, plugin);
}
bool sendRemoteMessage(CSimpleSocket *socket, int16_t id, const MessageLite *msg, bool size_ready)
@ -371,14 +371,14 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
if (!isValid())
{
out.printerr("Calling an unbound RPC function %s::%s.\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
return CR_NOT_IMPLEMENTED;
}
if (!p_client->socket->IsSocketValid())
{
out.printerr("In call to %s::%s: invalid socket.\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
return CR_LINK_FAILURE;
}
@ -387,14 +387,14 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
if (send_size > RPCMessageHeader::MAX_MESSAGE_SIZE)
{
out.printerr("In call to %s::%s: message too large: %d.\n",
this->proto.c_str(), this->name.c_str(), send_size);
this->plugin.c_str(), this->name.c_str(), send_size);
return CR_LINK_FAILURE;
}
if (!sendRemoteMessage(p_client->socket, id, input, true))
{
out.printerr("In call to %s::%s: I/O error in send.\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
return CR_LINK_FAILURE;
}
@ -409,7 +409,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
if (!readFullBuffer(p_client->socket, &header, sizeof(header)))
{
out.printerr("In call to %s::%s: I/O error in receive header.\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
return CR_LINK_FAILURE;
}
@ -421,7 +421,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE)
{
out.printerr("In call to %s::%s: invalid received size %d.\n",
this->proto.c_str(), this->name.c_str(), header.size);
this->plugin.c_str(), this->name.c_str(), header.size);
return CR_LINK_FAILURE;
}
@ -430,7 +430,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
if (!readFullBuffer(p_client->socket, buf, header.size))
{
out.printerr("In call to %s::%s: I/O error in receive %d bytes of data.\n",
this->proto.c_str(), this->name.c_str(), header.size);
this->plugin.c_str(), this->name.c_str(), header.size);
return CR_LINK_FAILURE;
}
@ -439,7 +439,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
if (!output->ParseFromArray(buf, header.size))
{
out.printerr("In call to %s::%s: error parsing received result.\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
delete[] buf;
return CR_LINK_FAILURE;
}
@ -453,7 +453,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out,
text_decoder.decode(&text_data);
else
out.printerr("In call to %s::%s: received invalid text data.\n",
this->proto.c_str(), this->name.c_str());
this->plugin.c_str(), this->name.c_str());
break;
default:

@ -150,10 +150,10 @@ namespace DFHack
class DFHACK_EXPORT RemoteFunctionBase : public RPCFunctionBase {
public:
bool bind(RemoteClient *client, const std::string &name,
const std::string &proto = std::string());
const std::string &plugin = std::string());
bool bind(color_ostream &out,
RemoteClient *client, const std::string &name,
const std::string &proto = std::string());
const std::string &plugin = std::string());
bool isValid() { return (id >= 0); }
@ -167,7 +167,7 @@ namespace DFHack
inline color_ostream &default_ostream();
command_result execute(color_ostream &out, const message_type *input, message_type *output);
std::string name, proto;
std::string name, plugin;
RemoteClient *p_client;
int16_t id;
};
@ -227,7 +227,7 @@ namespace DFHack
friend class RemoteFunctionBase;
bool bind(color_ostream &out, RemoteFunctionBase *function,
const std::string &name, const std::string &proto);
const std::string &name, const std::string &plugin);
public:
RemoteClient(color_ostream *default_output = NULL);
@ -269,8 +269,8 @@ namespace DFHack
}
inline bool RemoteFunctionBase::bind(RemoteClient *client, const std::string &name,
const std::string &proto) {
return bind(client->default_output(), client, name, proto);
const std::string &plugin) {
return bind(client->default_output(), client, name, plugin);
}
class RemoteSuspender {