char-socket: introduce update_disconnected_filename()
This helper will be used in yet another place in the following patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
e1f98fe48a
commit
bbcde969b2
@ -366,6 +366,15 @@ static char *SocketAddress_to_str(const char *prefix, SocketAddress *addr,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void update_disconnected_filename(SocketChardev *s)
|
||||||
|
{
|
||||||
|
Chardev *chr = CHARDEV(s);
|
||||||
|
|
||||||
|
g_free(chr->filename);
|
||||||
|
chr->filename = SocketAddress_to_str("disconnected:", s->addr,
|
||||||
|
s->is_listen, s->is_telnet);
|
||||||
|
}
|
||||||
|
|
||||||
static void tcp_chr_disconnect(Chardev *chr)
|
static void tcp_chr_disconnect(Chardev *chr)
|
||||||
{
|
{
|
||||||
SocketChardev *s = SOCKET_CHARDEV(chr);
|
SocketChardev *s = SOCKET_CHARDEV(chr);
|
||||||
@ -380,8 +389,7 @@ static void tcp_chr_disconnect(Chardev *chr)
|
|||||||
s->listen_tag = qio_channel_add_watch(
|
s->listen_tag = qio_channel_add_watch(
|
||||||
QIO_CHANNEL(s->listen_ioc), G_IO_IN, tcp_chr_accept, chr, NULL);
|
QIO_CHANNEL(s->listen_ioc), G_IO_IN, tcp_chr_accept, chr, NULL);
|
||||||
}
|
}
|
||||||
chr->filename = SocketAddress_to_str("disconnected:", s->addr,
|
update_disconnected_filename(s);
|
||||||
s->is_listen, s->is_telnet);
|
|
||||||
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
|
qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
|
||||||
if (s->reconnect_time) {
|
if (s->reconnect_time) {
|
||||||
qemu_chr_socket_restart_timer(chr);
|
qemu_chr_socket_restart_timer(chr);
|
||||||
@ -875,8 +883,7 @@ static void qmp_chardev_open_socket(Chardev *chr,
|
|||||||
/* be isn't opened until we get a connection */
|
/* be isn't opened until we get a connection */
|
||||||
*be_opened = false;
|
*be_opened = false;
|
||||||
|
|
||||||
chr->filename = SocketAddress_to_str("disconnected:",
|
update_disconnected_filename(s);
|
||||||
addr, is_listen, is_telnet);
|
|
||||||
|
|
||||||
if (is_listen) {
|
if (is_listen) {
|
||||||
if (is_telnet) {
|
if (is_telnet) {
|
||||||
|
Loading…
Reference in New Issue
Block a user