Survive death of GUId connection

We don't need the GUI anyway. Error was:

    Fatal error: exception Failure("End-of-file from GUId in dom0")
    Raised at file "pervasives.ml", line 30, characters 22-33
    Called from file "src/core/lwt.ml", line 754, characters 44-47
    Mirage exiting with status 2
    Do_exit called!
This commit is contained in:
Thomas Leonard 2016-01-17 13:19:40 +00:00
parent 3409a19792
commit 221c797241

View File

@ -41,6 +41,19 @@ module Main (Clock : V1.CLOCK) = struct
Uplink.listen uplink router Uplink.listen uplink router
] ]
(* We don't use the GUI, but it's interesting to keep an eye on it.
If the other end dies, don't let it take us with it (can happen on log out). *)
let watch_gui gui =
Lwt.async (fun () ->
Lwt.try_bind
(fun () -> GUI.listen gui)
(fun `Cant_happen -> assert false)
(fun ex ->
Log.warn (fun f -> f "GUI thread failed: %s" (Printexc.to_string ex));
return ()
)
)
(* Control which of the messages that reach the reporter are logged to the console. (* Control which of the messages that reach the reporter are logged to the console.
The rest will be displayed only if an error occurs. The rest will be displayed only if an error occurs.
Note: use the regular [Logs] configuration settings to determine which messages Note: use the regular [Logs] configuration settings to determine which messages
@ -59,7 +72,7 @@ module Main (Clock : V1.CLOCK) = struct
qrexec >>= fun qrexec -> qrexec >>= fun qrexec ->
let agent_listener = RExec.listen qrexec Command.handler in let agent_listener = RExec.listen qrexec Command.handler in
gui >>= fun gui -> gui >>= fun gui ->
Lwt.async (fun () -> GUI.listen gui); watch_gui gui;
qubesDB >>= fun qubesDB -> qubesDB >>= fun qubesDB ->
Log.info (fun f -> f "agents connected in %.3f s (CPU time used since boot: %.3f s)" Log.info (fun f -> f "agents connected in %.3f s (CPU time used since boot: %.3f s)"
(Clock.time () -. start_time) (Sys.time ())); (Clock.time () -. start_time) (Sys.time ()));