qemu-char: make tcp_chr_disconnect() reentrant-safe

During CHR_EVENT_CLOSED, the function could be reentered, make this
case safe.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Marc-André Lureau
2016-03-11 16:59:12 +02:00
committed by Michael S. Tsirkin
parent 6167ebbd91
commit 342f7a9d05
+4
View File
@@ -2769,6 +2769,10 @@ static void tcp_chr_disconnect(CharDriverState *chr)
{
TCPCharDriver *s = chr->opaque;
if (!s->connected) {
return;
}
s->connected = 0;
if (s->listen_ioc) {
s->listen_tag = qio_channel_add_watch(