1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(console): novncd waits at most 5 s for a VNC server to answer

websockify's socket() connects without a timeout, so a console address
that does not answer held the console's process for the OS's TCP timeout
(some 2 minutes) before the page heard of it. novncd now connects with
CONNECT_TIMEOUT, then waits on the open connection as before.
This commit is contained in:
catborise 2026-11-05 17:28:51 +03:00
parent f458c42ba7
commit dda579b69a
2 changed files with 16 additions and 2 deletions

View file

@ -570,6 +570,12 @@ class NovncdDaemonLogicTestCase(TestCase):
# the VM access was checked for, not whichever VM has its name now
self.assertEqual(mock_wvm.call_args.kwargs["uuid"], mock_instance.uuid)
def test_the_vnc_server_is_waited_for_a_bounded_time(self):
with patch.object(novncd_mod.socket, "create_connection") as create_connection:
tsock = novncd_mod.bounded_connect("192.0.2.40", 5900, connect=True)
create_connection.assert_called_once_with(("192.0.2.40", 5900), timeout=novncd_mod.CONNECT_TIMEOUT)
tsock.settimeout.assert_called_once_with(None)
def test_a_token_without_its_users_session_is_refused_and_logged(self):
from logs.models import Logs