refactor(msgpack): allow flushing buffer while packing msgpack

Before, we needed to always pack an entire msgpack_rpc Object to
a continous memory buffer before sending it out to a channel.
But this is generally wasteful. it is better to just flush
whatever is in the buffer and then continue packing to a new buffer.

This is also done for the UI event packer where there are some extra logic
to "finish" of an existing batch of nevents/ncalls. This doesn't really
stop us from flushing the buffer, just that we need to update the state
machine accordingly so the next call to prepare_call() always will
start with a new event (even though the buffer might contain overflow
data from a large event).
This commit is contained in:
bfredl
2024-02-25 15:02:48 +01:00
parent 6525832a8c
commit dc37c1550b
18 changed files with 560 additions and 603 deletions

View File

@@ -70,7 +70,6 @@
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
@@ -152,11 +151,9 @@ void event_init(void)
loop_init(&main_loop, NULL);
resize_events = multiqueue_new_child(main_loop.events);
// early msgpack-rpc initialization
msgpack_rpc_helpers_init();
input_init();
signal_init();
// finish mspgack-rpc initialization
// mspgack-rpc initialization
channel_init();
terminal_init();
ui_init();