more debug output from vmmd_tls

This commit is contained in:
Hannes Mehnert 2018-11-03 00:04:14 +01:00
parent e5f8248668
commit 7b3d94db8c

View file

@ -78,16 +78,18 @@ let handle ca (tls, addr) =
| Error `Exception -> Lwt.return (Error (`Msg "failed to write policy")) | Error `Exception -> Lwt.return (Error (`Msg "failed to write policy"))
| Ok () -> | Ok () ->
Vmm_lwt.read_wire fd >|= function Vmm_lwt.read_wire fd >|= function
| Error _ -> Error (`Msg "read error") | Error _ -> Error (`Msg "read error after writing policy")
| Ok (_, `Success _) -> Ok () | Ok (_, `Success _) -> Ok ()
| Ok _ -> | Ok wire ->
(* TODO check version *) (* TODO check version *)
Error (`Msg ("expected success, received something else when adding policy"))) Rresult.R.error_msgf
"expected success when adding policy, got: %a"
Vmm_commands.pp_wire wire)
(Ok ()) policies (Ok ()) policies
| _ -> Lwt.return (Ok ())) >>= function | _ -> Lwt.return (Ok ())) >>= function
| Error (`Msg msg) -> | Error (`Msg msg) ->
begin begin
Logs.debug (fun m -> m "error while applying policies %s" msg) ; Logs.warn (fun m -> m "error while applying policies %s" msg) ;
let wire = let wire =
let header = Vmm_commands.{version = my_version ; sequence = 0L ; id = name } in let header = Vmm_commands.{version = my_version ; sequence = 0L ; id = name } in
header, `Failure msg header, `Failure msg