Use SO_REUSEADDR before calling bind() where missing. Fixes #1289.

This commit is contained in:
grossmj
2018-04-16 16:36:36 +08:00
parent 5c4f6dd3dc
commit dd9c18b9f8
4 changed files with 4 additions and 1 deletions

View File

@ -894,6 +894,7 @@ class QemuVM(BaseNode):
af, socktype, proto, _, sa = res
# let the OS find an unused port for the Qemu monitor
with socket.socket(af, socktype, proto) as sock:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(sa)
self._monitor = sock.getsockname()[1]
except OSError as e: