[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 19/37] char: disconnect peer when qemu_chr_fr
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 19/37] char: disconnect peer when qemu_chr_free() |
Date: |
Mon, 1 Aug 2016 14:48:40 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
On 28/07/2016 16:37, address@hidden wrote:
> From: Marc-André Lureau <address@hidden>
>
> chr_disconnect callback is used to cleanup server socket peer. This
> removes some leaks when the chardev is freed.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> qemu-char.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index e4b8448..6ed6dd6 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -4031,6 +4031,7 @@ static void qemu_chr_free_common(CharDriverState *chr)
>
> void qemu_chr_free(CharDriverState *chr)
> {
> + qemu_chr_disconnect(chr);
> if (chr->chr_close) {
> chr->chr_close(chr);
> }
>
The patch, as is, would cause for example two calls to
qemu_chr_be_event(chr, CHR_EVENT_CLOSED). It's also unnecessary to set
up a watch on s->listen_ioc and to call qemu_chr_socket_restart_timer.
I think the right fix is to extract the relevant parts of
tcp_chr_disconnect into a new function (e.g. tcp_chr_free_connection)
and call the function from tcp_chr_close.
Paolo
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v2 19/37] char: disconnect peer when qemu_chr_free(),
Paolo Bonzini <=