mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 12:28:18 +00:00
msgpack-rpc: Move handle_missing_method to msgpack_rpc.c
Since that function is not automatically generated, it's best to place it in a normal C module
This commit is contained in:
@@ -220,18 +220,6 @@ for i = 1, #api.functions do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
output:write([[
|
|
||||||
static Object handle_missing_method(uint64_t channel_id,
|
|
||||||
msgpack_object *req,
|
|
||||||
Error *error)
|
|
||||||
{
|
|
||||||
snprintf(error->msg, sizeof(error->msg), "Invalid function id");
|
|
||||||
error->set = true;
|
|
||||||
return NIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
]])
|
|
||||||
|
|
||||||
-- Generate the table of handler functions indexed by method id
|
-- Generate the table of handler functions indexed by method id
|
||||||
output:write([[
|
output:write([[
|
||||||
static const rpc_method_handler_fn rpc_method_handlers[] = {
|
static const rpc_method_handler_fn rpc_method_handlers[] = {
|
||||||
@@ -290,7 +278,7 @@ output:write([[
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
handler = handle_missing_method;
|
handler = msgpack_rpc_handle_missing_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handler(channel_id, req, error);
|
return handler(channel_id, req, error);
|
||||||
|
@@ -115,6 +115,16 @@ void msgpack_rpc_error(char *msg, msgpack_packer *res)
|
|||||||
msgpack_pack_nil(res);
|
msgpack_pack_nil(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Handler executed when an invalid method name is passed
|
||||||
|
Object msgpack_rpc_handle_missing_method(uint64_t channel_id,
|
||||||
|
msgpack_object *req,
|
||||||
|
Error *error)
|
||||||
|
{
|
||||||
|
snprintf(error->msg, sizeof(error->msg), "Invalid method name");
|
||||||
|
error->set = true;
|
||||||
|
return NIL;
|
||||||
|
}
|
||||||
|
|
||||||
/// Serializes a msgpack-rpc request or notification(id == 0)
|
/// Serializes a msgpack-rpc request or notification(id == 0)
|
||||||
WBuffer *serialize_request(uint64_t request_id,
|
WBuffer *serialize_request(uint64_t request_id,
|
||||||
String method,
|
String method,
|
||||||
|
Reference in New Issue
Block a user