mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
chardev/char-pty: send CHR_EVENT_CLOSED on disconnect
Change makes code symmetric to the code, which handles the "connected" state, i.e. send CHR_EVENT_CLOSED when state changes from "connected" to "disconnected". This behavior is similar to char-socket, for example. Signed-off-by: Roman Penyaev <r.peniaev@gmail.com> Reviewed-by: "Marc-André Lureau" <marcandre.lureau@redhat.com> Reviewed-by: "Alex Bennée" <alex.bennee@linaro.org> Cc: qemu-devel@nongnu.org Message-ID: <20250123085327.965501-2-r.peniaev@gmail.com>
This commit is contained in:
parent
6fccaa2fba
commit
4e059a9d96
1 changed files with 3 additions and 1 deletions
|
@ -181,6 +181,9 @@ static void pty_chr_state(Chardev *chr, int connected)
|
|||
|
||||
if (!connected) {
|
||||
remove_fd_in_watch(chr);
|
||||
if (s->connected) {
|
||||
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
|
||||
}
|
||||
s->connected = 0;
|
||||
/* (re-)connect poll interval for idle guests: once per second.
|
||||
* We check more frequently in case the guests sends data to
|
||||
|
@ -215,7 +218,6 @@ static void char_pty_finalize(Object *obj)
|
|||
pty_chr_state(chr, 0);
|
||||
object_unref(OBJECT(s->ioc));
|
||||
pty_chr_timer_cancel(s);
|
||||
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
|
||||
}
|
||||
|
||||
#if defined HAVE_PTY_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue