mirror of
https://github.com/neovim/neovim
synced 2025-07-25 07:41:53 +00:00
fix(rpc): fix hang with channel closed while waiting for response
This commit is contained in:
committed by
GitHub
parent
d4e80a051e
commit
c422722b2e
@ -207,9 +207,15 @@ Object rpc_send_call(uint64_t id, const char *method_name, Array args, ArenaMem
|
|||||||
// Push the frame
|
// Push the frame
|
||||||
ChannelCallFrame frame = { request_id, false, false, NIL, NULL };
|
ChannelCallFrame frame = { request_id, false, false, NIL, NULL };
|
||||||
kv_push(rpc->call_stack, &frame);
|
kv_push(rpc->call_stack, &frame);
|
||||||
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, channel->events, -1, frame.returned);
|
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, channel->events, -1, frame.returned || rpc->closed);
|
||||||
(void)kv_pop(rpc->call_stack);
|
(void)kv_pop(rpc->call_stack);
|
||||||
|
|
||||||
|
if (rpc->closed) {
|
||||||
|
api_set_error(err, kErrorTypeException, "Invalid channel: %" PRIu64, id);
|
||||||
|
channel_decref(channel);
|
||||||
|
return NIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (frame.errored) {
|
if (frame.errored) {
|
||||||
if (frame.result.type == kObjectTypeString) {
|
if (frame.result.type == kObjectTypeString) {
|
||||||
api_set_error(err, kErrorTypeException, "%s",
|
api_set_error(err, kErrorTypeException, "%s",
|
||||||
|
Reference in New Issue
Block a user