This change is needed because when an AppVM does not complete the vif initialization (e.g., windows HVM AppVM), the unikernel does not accept more clients.

This commit is contained in:
Pierre Alain 2025-07-15 16:26:01 +02:00
parent f904cbbc39
commit 45e7d0d52f

View file

@ -441,7 +441,6 @@ let add_client get_ts dns_client dns_servers ~router vif client_ip qubesDB
(** Watch XenStore for notifications of new clients. *)
let wait_clients get_ts dns_client dns_servers qubesDB router =
let open Lwt.Syntax in
let clients : Cleanup.t Dao.VifMap.t ref = ref Dao.VifMap.empty in
Dao.watch_clients @@ fun new_set ->
(* Check for removed clients *)
@ -458,19 +457,18 @@ let wait_clients get_ts dns_client dns_servers qubesDB router =
| None -> Lwt.return_unit
| Some ((key, ipaddr), seq) when not (Dao.VifMap.mem key !clients) ->
let cleanup_tasks = Cleanup.create () in
let* () =
Lwt.catch
(fun () ->
add_client get_ts dns_client dns_servers ~router key ipaddr
qubesDB ~cleanup_tasks)
(function
| Xs_protocol.Error _ ->
Log.warn (fun f ->
f "Client %a has not terminated its vif initialisation"
Dao.ClientVif.pp key);
Lwt.return_unit
| e -> Lwt.fail e)
in
Lwt.async (fun () ->
Lwt.catch
(fun () ->
add_client get_ts dns_client dns_servers ~router key ipaddr
qubesDB ~cleanup_tasks)
(function
| Xs_protocol.Error _ ->
Log.warn (fun f ->
f "Client %a has not terminated its vif initialisation"
Dao.ClientVif.pp key);
Lwt.return_unit
| e -> Lwt.fail e));
Log.debug (fun f -> f "client %a arrived" Dao.ClientVif.pp key);
clients := Dao.VifMap.add key cleanup_tasks !clients;
go seq