Better fix for EOF handling with WebSockets
Used to spin.
This commit is contained in:
parent
3002fb32b0
commit
5c380878d5
|
@ -3238,16 +3238,13 @@ on_tty_readable (EV_P_ ev_io *handle, int revents)
|
||||||
{
|
{
|
||||||
(void) handle;
|
(void) handle;
|
||||||
|
|
||||||
static bool readline_reentrancy_lock;
|
|
||||||
if (readline_reentrancy_lock)
|
|
||||||
return;
|
|
||||||
|
|
||||||
struct app_context *ctx = ev_userdata (loop);
|
struct app_context *ctx = ev_userdata (loop);
|
||||||
if (revents & EV_READ)
|
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);
|
ctx->input->vtable->on_tty_readable (ctx->input);
|
||||||
readline_reentrancy_lock = false;
|
ev_io_start (EV_DEFAULT_ &ctx->tty_watcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue