]> git.pond.sub.org Git - empserver/commit
client: Fix obscure readline hang
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Nov 2016 16:05:19 +0000 (17:05 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 09:22:29 +0000 (11:22 +0200)
commit5e82836e3a74d1e0d30510b24ad0582f0a960652
tree01108c5169c6c4ca7d3f07c45c1bde3c8a7d4fa2
parent0cb66906009297f0beb9f3b71648635bb190d260
client: Fix obscure readline hang

If recv_input() can't stuff the whole line into @inbuf, it leaves its
tail in @input_from_rl.  If send_input() then empties @inbuf, the next
iteration will select @input_fd for reading instead of @sock for
writing, because @inbuf is empty.  Since @has_rl_input is still set,
recv_input() will do nothing, and the client hangs.

Fix as follows.  Factor ring_from_rl() out of recv_input().  Also call
it in send_input() to refill @inbuf from @input_from_rl.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/client/play.c