diff options
Diffstat (limited to 'src/nvim/msgpack_rpc/channel.c')
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 32781cf4d9..26b84b7cc7 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -61,6 +61,7 @@ void rpc_start(Channel *channel) rpc->unpacker = msgpack_unpacker_new(MSGPACK_UNPACKER_INIT_BUFFER_SIZE); rpc->subscribed_events = pmap_new(cstr_t)(); rpc->next_request_id = 1; + rpc->info = (Dictionary)ARRAY_DICT_INIT; kv_init(rpc->call_stack); if (channel->streamtype != kChannelStreamInternal) { @@ -553,6 +554,7 @@ void rpc_free(Channel *channel) pmap_free(cstr_t)(channel->rpc.subscribed_events); kv_destroy(channel->rpc.call_stack); + api_free_dictionary(channel->rpc.info); } static bool is_rpc_response(msgpack_object *obj) @@ -642,6 +644,23 @@ static WBuffer *serialize_response(uint64_t channel_id, return rv; } +void rpc_set_client_info(uint64_t id, Dictionary info) +{ + Channel *chan = find_rpc_channel(id); + if (!chan) { + abort(); + } + + api_free_dictionary(chan->rpc.info); + chan->rpc.info = info; + channel_info_changed(chan, false); +} + +Dictionary rpc_client_info(Channel *chan) +{ + return copy_dictionary(chan->rpc.info); +} + #if MIN_LOG_LEVEL <= DEBUG_LOG_LEVEL #define REQ "[request] " #define RES "[response] " |