aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/msgpack_rpc/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/msgpack_rpc/channel.c')
-rw-r--r--src/nvim/msgpack_rpc/channel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 5564bfa1be..da1dc8d1b5 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -119,7 +119,7 @@ void channel_teardown(void)
/// Creates an API channel by starting a job and connecting to its
/// stdin/stdout. stderr is forwarded to the editor error stream.
///
-/// @param argv The argument vector for the process
+/// @param argv The argument vector for the process. [consumed]
/// @return The channel id
uint64_t channel_from_job(char **argv)
{
@@ -436,6 +436,11 @@ static void handle_request(Channel *channel, msgpack_object *request)
&error,
NIL,
&out_buffer));
+ char buf[256];
+ snprintf(buf, sizeof(buf),
+ "Channel %" PRIu64 " sent an invalid message, closing.",
+ channel->id);
+ call_set_error(channel, buf);
return;
}
@@ -491,6 +496,10 @@ static bool channel_write(Channel *channel, WBuffer *buffer)
{
bool success;
+ if (channel->closed) {
+ return false;
+ }
+
if (channel->is_job) {
success = job_write(channel->data.job, buffer);
} else {