summaryrefslogtreecommitdiff
path: root/json-rpc-shell.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2018-04-16 22:25:54 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2018-04-16 22:26:18 +0200
commit5c380878d5b1c3dd677a3674b5bc0bcb4c6aef80 (patch)
treefb4bf3c46a6508482e6f3a4a2e8f89e4176ea5ec /json-rpc-shell.c
parent3002fb32b0c7fac0b621b3eb7fb83edff0b27e0b (diff)
downloadjson-rpc-shell-5c380878d5b1c3dd677a3674b5bc0bcb4c6aef80.tar.gz
json-rpc-shell-5c380878d5b1c3dd677a3674b5bc0bcb4c6aef80.tar.xz
json-rpc-shell-5c380878d5b1c3dd677a3674b5bc0bcb4c6aef80.zip
Better fix for EOF handling with WebSockets
Used to spin.
Diffstat (limited to 'json-rpc-shell.c')
-rw-r--r--json-rpc-shell.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/json-rpc-shell.c b/json-rpc-shell.c
index 076e53f..716e74c 100644
--- a/json-rpc-shell.c
+++ b/json-rpc-shell.c
@@ -3238,16 +3238,13 @@ on_tty_readable (EV_P_ ev_io *handle, int revents)
{
(void) handle;
- static bool readline_reentrancy_lock;
- if (readline_reentrancy_lock)
- return;
-
struct app_context *ctx = ev_userdata (loop);
if (revents & EV_READ)
{
- readline_reentrancy_lock = true;
+ // rl_callback_read_char() is not reentrant, may happen on EOF
+ ev_io_stop (EV_DEFAULT_ &ctx->tty_watcher);
ctx->input->vtable->on_tty_readable (ctx->input);
- readline_reentrancy_lock = false;
+ ev_io_start (EV_DEFAULT_ &ctx->tty_watcher);
}
}