diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-17 20:54:24 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-17 20:54:24 +0200 |
commit | 4da55bcedf111f3d0fbaf1e1b8eb3dfa51488348 (patch) | |
tree | 9b1a5e178549fb03b690db5ac6f5ebf77eb34533 /lib/sasl.ml | |
parent | d0c1539993c64fa10ee76ebacd02ee054205630e (diff) |
feat(stream): wrap Lwt_stream.get to support ClosedStream exception
Diffstat (limited to 'lib/sasl.ml')
-rw-r--r-- | lib/sasl.ml | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/sasl.ml b/lib/sasl.ml index 3c2ae20..088543b 100644 --- a/lib/sasl.ml +++ b/lib/sasl.ml @@ -47,12 +47,9 @@ let send_auth_stanza (stream, push) localpart pass mechanism = `Text [gen_auth mechanism]; `End_element] in Markup.(stanza_list |> of_list |> write_xml |> to_string) |> Option.some |> push; - let* response = Lwt_stream.get stream - in try - match response with - | Some stanza -> parse_sasl_response stanza |> Lwt.return - | None -> Lwt.fail Stream.ClosedStream - with exn -> Lwt.fail exn + let* response = Stream.get stream + in try parse_sasl_response response |> Lwt.return + with exn -> Lwt.fail exn let authenticate (portal : Portal.t) (config : auth_config) = let {jid; password; _} = config |