diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-29 20:48:27 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-29 20:48:27 +0200 |
commit | 0182a2e8b2f48032f8783215ad62349674e2bdb7 (patch) | |
tree | 558b9f14b7183cf8216c9a2faae2a0cf4a133d4b /lib/flesh.ml | |
parent | 4d5f6957b59384cb2c6c9f2e45bbaa3c0640ba82 (diff) |
refactor(stream): move features to module Feature
Diffstat (limited to 'lib/flesh.ml')
-rw-r--r-- | lib/flesh.ml | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/flesh.ml b/lib/flesh.ml index 55eeefc..03882b4 100644 --- a/lib/flesh.ml +++ b/lib/flesh.ml @@ -15,21 +15,22 @@ open Lwt.Infix Portal in a "ready" state. *) let connect (domain : string) (config : Stream.config) : (Portal.t * Stream.features) Lwt.t = let open Portal in + let open Stream in let* portal = connect domain in let needs_restart = function - | Stream.Mechanisms _ | STARTTLS -> true + | Feature.Mechanisms _ | STARTTLS -> true | _ -> false in let+ features = let rec handle_features (features : Stream.features) : Stream.features Lwt.t = match features with - | feature :: mandatory, optional -> - let* () = Stream.negotiate true feature portal config - in if needs_restart feature - then Stream.start domain portal >>= handle_features - else handle_features (mandatory, optional) + | feature :: rest -> + let* () = negotiate feature portal config + in if needs_restart (Feature.unwrap feature) + then start domain portal >>= handle_features + else handle_features rest | features -> Lwt.return features - in Stream.start domain portal >>= handle_features + in start domain portal >>= handle_features in (portal, features) |