mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
char-socket: update local address after listen
This is mainly useful to know the actual bound port when using port 0. For example, when starting qemu with socket on port 0, before: QEMU waiting for connection on: disconnected:tcp:localhost:0,server After: QEMU waiting for connection on: disconnected:tcp:localhost:32454,server Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
bbcde969b2
commit
bc763d7144
1 changed files with 5 additions and 0 deletions
|
@ -911,6 +911,11 @@ static void qmp_chardev_open_socket(Chardev *chr,
|
|||
if (qio_channel_socket_listen_sync(sioc, s->addr, errp) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
qapi_free_SocketAddress(s->addr);
|
||||
s->addr = socket_local_address(sioc->fd, errp);
|
||||
update_disconnected_filename(s);
|
||||
|
||||
s->listen_ioc = sioc;
|
||||
if (is_waitconnect &&
|
||||
qemu_chr_wait_connected(chr, errp) < 0) {
|
||||
|
|
Loading…
Reference in a new issue