diff options
author | Juraj Marcin <jmarcin@redhat.com> | 2025-05-21 15:52:32 +0200 |
---|---|---|
committer | Daniel P. Berrangé <berrange@redhat.com> | 2025-05-22 11:24:41 +0100 |
commit | 911e0f2c6e2d00c985affa75ec188c8edcf480f2 (patch) | |
tree | 00da4e67a23a4c2143a531dabd26d0b255287702 /scripts/vmstate-static-checker.py | |
parent | b8b5278aca78be4a1c2e7cbb11c6be176f63706d (diff) | |
download | qemu-911e0f2c6e2d00c985affa75ec188c8edcf480f2.zip qemu-911e0f2c6e2d00c985affa75ec188c8edcf480f2.tar.gz qemu-911e0f2c6e2d00c985affa75ec188c8edcf480f2.tar.bz2 |
util/qemu-sockets: Refactor success and failure paths in inet_listen_saddr()
To get a listening socket, we need to first create a socket, try binding
it to a certain port, and lastly starting listening to it. Each of these
operations can fail due to various reasons, one of them being that the
requested address/port is already in use. In such case, the function
tries the same process with a new port number.
This patch refactors the port number loop, so the success path is no
longer buried inside the 'if' statements in the middle of the loop. Now,
the success path is not nested and ends at the end of the iteration
after successful socket creation, binding, and listening. In case any of
the operations fails, it either continues to the next iteration (and the
next port) or jumps out of the loop to handle the error and exits the
function.
Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'scripts/vmstate-static-checker.py')
0 files changed, 0 insertions, 0 deletions