diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-08-28 15:46:21 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-08-29 22:08:58 -0300 |
commit | aa23d2f835e32c01b318712459ba7b9f55922469 (patch) | |
tree | 8476c7d99b32b8e4faea05ddfdb8cd1f4e6f370f /src/nvim/os/msgpack_rpc.c | |
parent | 9d5e2c34c95739c8130f33aad8a18b19a281a1ad (diff) | |
download | rneovim-aa23d2f835e32c01b318712459ba7b9f55922469.tar.gz rneovim-aa23d2f835e32c01b318712459ba7b9f55922469.tar.bz2 rneovim-aa23d2f835e32c01b318712459ba7b9f55922469.zip |
msgpack-rpc: Accept method names in requests
Diffstat (limited to 'src/nvim/os/msgpack_rpc.c')
-rw-r--r-- | src/nvim/os/msgpack_rpc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/os/msgpack_rpc.c b/src/nvim/os/msgpack_rpc.c index c03d8dccca..90673fef13 100644 --- a/src/nvim/os/msgpack_rpc.c +++ b/src/nvim/os/msgpack_rpc.c @@ -39,15 +39,14 @@ WBuffer *msgpack_rpc_call(uint64_t channel_id, return serialize_response(response_id, err, NIL, sbuffer); } - uint64_t method_id = req->via.array.ptr[2].via.u64; - - if (method_id == 0) { + if (req->via.array.ptr[2].type == MSGPACK_OBJECT_POSITIVE_INTEGER + && req->via.array.ptr[2].via.u64 == 0) { return serialize_metadata(response_id, channel_id, sbuffer); } // dispatch the call Error error = { .set = false }; - Object rv = msgpack_rpc_dispatch(channel_id, method_id, req, &error); + Object rv = msgpack_rpc_dispatch(channel_id, req, &error); // send the response msgpack_packer response; msgpack_packer_init(&response, sbuffer, msgpack_sbuffer_write); @@ -235,8 +234,9 @@ static char *msgpack_rpc_validate(uint64_t *response_id, msgpack_object *req) return "Message type must be 0"; } - if (req->via.array.ptr[2].type != MSGPACK_OBJECT_POSITIVE_INTEGER) { - return "Method id must be a positive integer"; + if (req->via.array.ptr[2].type != MSGPACK_OBJECT_POSITIVE_INTEGER + && req->via.array.ptr[2].type != MSGPACK_OBJECT_RAW) { + return "Method must be a positive integer or a string"; } if (req->via.array.ptr[3].type != MSGPACK_OBJECT_ARRAY) { |